/brass-souffle

See how easy it is to express board game rules with Datalog

Primary LanguagePythonThe UnlicenseUnlicense

Find Legal Moves in Brass Birmingham with Logic Programming

This short experiment shows how easy it is to express boardgame rules with logic programming. This repo is a supplemnt to my blog post, please read it for more context.

Install Souffle

I use Souffle, a dialect of Datalog for this project. Visit the Souffle docs for installation instructions. For mac os you can just do

brew install souffle

Run Example

In order to run the basic toy example do

souffle brass.dl

you should get the following output

---------------
player_network
===============
1	a
1	b
1	d
===============
---------------
can_place_boat
===============
1	a	d
1	b	c
1	d	e
===============
---------------
can_place_factory
===============
1	a	coal	1

If you want to learn more about Souffle head to their tutorial.