{"author_link":"\/users\/anne-ogborn","author_name":"Anne Ogborn","author_uid":"anne-ogborn","comments":[],"epoch":1570536805,"event":"LD45","format":"md","ldjam_node_id":174307,"likes":0,"metadata":{"p_key":"136399","p_author":"Anne Ogborn","p_authorkey":"1011841","p_urlkey":"352675","p_title":"The tech behind 3 Little Pigs","p_cat":"LDJam ","p_event":"LD45","p_time":"1570536805","p_likes":"0","p_comments":"0","p_status":"WAYBACK","us_key":"1011841","us_name":"Anne Ogborn","us_username":"anne-ogborn","event_start":"1570147200","event_key":"78","event_name":"Ludum Dare 45"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD45","removed_author":false},"_superparent":159347,"_trust":2,"author":11841,"body":"So, the crazy Team SWI-Prolog folks built a rather simple game where you draw houses.\n\nThis post is about the tech we used to build it. We enter Ludum Dare just to stretch our technology.\nAnd it worked! SWI-Prolog and CHR worked out great for this. So we're excited.\n\n[SWI-Prolog](http:\/\/swi-prolog.org\/) is a logic language - you write down a set of rules for how your world works, and then ask it questions about the world.\n\nThe front end of the game is Snap! - just because it was an easy way to build a graphic front end.\n\nWhen you stop drawing, Snap sends the list of lines to a web server written in SWI-Prolog. Now for the magic part.\nThe lines come in, and we put them in the 'constraint store' of a system called 'constraint handling rules' that comes\nwith SWI-Prolog.\nWe start recognizing things about the lines, and adding things to the constraint store. \"Oh, that's a vertical line\".\nThen we have recognizers that work on already recognized parts - \"a vertical line and a horizontal line with one end near each other make a corner\" - \"two corners whose ends bboth nearly touch make a box\" - and eventually \"A triangle sitting atop a box is a house\". Then we have the prolog send back 'draw a house at x,y'\n\nOur original idea was that you could draw lots of different stuff - and there's code in there for a rocket - as a kind of art game. But you know game jams - we figured we'd best stick with just drawing houses.\n @paulbrownmagic made the Snap! game with the wolf and the pig.\n\nAnd we're getting nice comments about our little game. \n\nThanks for letting some academic programmer dweebs play with you all this weekend. Your games are beautiful and amazing. \n\nPlease play and rate our game. [3 Little Pigs page](https:\/\/ldjam.com\/events\/ludum-dare\/45\/three-little-pigs)\n\n![pigs.png](\/\/\/raw\/14e\/2\/z\/28c00.png)\n\n\n\n\n","comments":2,"comments-timestamp":"2022-08-22T04:44:21Z","created":"2019-10-08T11:37:35Z","files":[],"files-timestamp":0,"id":174307,"love":0,"meta":[],"modified":"2022-08-22T04:44:21Z","name":"The tech behind 3 Little Pigs","node-timestamp":"2019-10-08T12:13:25Z","parent":165282,"parents":[1,5,9,159347,165282],"path":"\/events\/ludum-dare\/45\/three-little-pigs\/the-tech-behind-3-little-pigs","published":"2019-10-08T12:13:25Z","scope":"public","slug":"the-tech-behind-3-little-pigs","subsubtype":"","subtype":"","type":"post","version":522490},"node_metadata":{"n_key":"174307","n_urlkey":"352675","n_parent":"165282","n_path":"\/events\/ludum-dare\/45\/three-little-pigs\/the-tech-behind-3-little-pigs","n_slug":"the-tech-behind-3-little-pigs","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"11841","n_created":"1570534655","n_modified":"1661143461","n_version":"522490","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/45\/three-little-pigs\/the-tech-behind-3-little-pigs","text":"So, the crazy Team SWI-Prolog folks built a rather simple game where you draw houses.\n\nThis post is about the tech we used to build it. We enter Ludum Dare just to stretch our technology.\nAnd it worked! SWI-Prolog and CHR worked out great for this. So we're excited.\n\n[SWI-Prolog](http:\/\/swi-prolog.org\/) is a logic language - you write down a set of rules for how your world works, and then ask it questions about the world.\n\nThe front end of the game is Snap! - just because it was an easy way to build a graphic front end.\n\nWhen you stop drawing, Snap sends the list of lines to a web server written in SWI-Prolog. Now for the magic part.\nThe lines come in, and we put them in the 'constraint store' of a system called 'constraint handling rules' that comes\nwith SWI-Prolog.\nWe start recognizing things about the lines, and adding things to the constraint store. \"Oh, that's a vertical line\".\nThen we have recognizers that work on already recognized parts - \"a vertical line and a horizontal line with one end near each other make a corner\" - \"two corners whose ends bboth nearly touch make a box\" - and eventually \"A triangle sitting atop a box is a house\". Then we have the prolog send back 'draw a house at x,y'\n\nOur original idea was that you could draw lots of different stuff - and there's code in there for a rocket - as a kind of art game. But you know game jams - we figured we'd best stick with just drawing houses.\n @paulbrownmagic made the Snap! game with the wolf and the pig.\n\nAnd we're getting nice comments about our little game. \n\nThanks for letting some academic programmer dweebs play with you all this weekend. Your games are beautiful and amazing. \n\nPlease play and rate our game. [3 Little Pigs page](https:\/\/ldjam.com\/events\/ludum-dare\/45\/three-little-pigs)\n\n![pigs.png](\/\/\/raw\/14e\/2\/z\/28c00.png)\n\n\n\n\n","title":"The tech behind 3 Little Pigs","wayback_source":[]}