Find Legal Moves in Brass Birmingham with Datalog
blog.pzakrzewski.com
Find Legal Moves in Brass Birmingham with Datalog
1–10 of 26 posts
Re: Find Legal Moves in Brass Birmingham with Datalog
#2Re: Find Legal Moves in Brass Birmingham with Datalog
#3Aside from the article, I do really like the idea of implementing board game rules as a coding exercise. The only one I’ve ever been confronted with was tic tac toe, and I remember really having fun with the detecting winning moves part.
Re: Find Legal Moves in Brass Birmingham with Datalog
#4I expressed the logical rules of Go, which are already phrased in a concise yet mathematically rigorous way, pretty much directly into Haskell [1], which was more fun than tedium.
Re: Find Legal Moves in Brass Birmingham with Datalog
#5My original attempt was clunky and I rewrote the logic from scratch 2 or 3 times until I could bear look at the code and not wince.
Re: Find Legal Moves in Brass Birmingham with Datalog
#6That was an issue I encountered when writing the logic for Shogi so that I could build my own engine. Writing Python to express the logical dependencies was surprisingly unintuitive. My original attempt was clunky and I rewrote the logic from scratch 2 or 3 times until I could bear look at the code and not wince.
Re: Find Legal Moves in Brass Birmingham with Datalog
#7Aside from the article, I do really like the idea of implementing board game rules as a coding exercise. The only one I’ve ever been confronted with was tic tac toe, and I remember really having fun with the detecting winning moves part.
I've been playing around with making a version of tic-tac-toe that's interesting to grown-ups. Experimenting with rules a lot as you'll see. (I think 1357 is probably the best but not sure.) https://5-by-5.edjohnsonwilliams.co.uk https://github.com/edjw/5_by_5_tictactoe
Though the counting seems a bit weird. Two overlapping lines of 5 seems to count as "1 two, 2 five". I also managed to get two overlapping fours to count as "2 two, 2 four". Maybe I just don't understand how it's supposed to work?
Re: Find Legal Moves in Brass Birmingham with Datalog
#8The datalog application that replaced an existing imperative solution is so much easier to understand and maintain.
Souffle generates c++ from the datalog program. We use SWIG to compile the c++ code into a Go application. So we have a Go application that deals with getting data in and out, and all of the business logic is defined in datalog.
Re: Find Legal Moves in Brass Birmingham with Datalog
#9I've become a big fan of datalog and souffle. We wrote a territory assignment application for a large healthcare organization with multiple overlapping marketing teams, where each team defines territories with various geographic and account attributes such that there's a hierarchy of precedence for the territory that should be assigned to each account. The datalog application that replaced an existing imperative solu…
Re: Find Legal Moves in Brass Birmingham with Datalog
#10I've become a big fan of datalog and souffle. We wrote a territory assignment application for a large healthcare organization with multiple overlapping marketing teams, where each team defines territories with various geographic and account attributes such that there's a hierarchy of precedence for the territory that should be assigned to each account. The datalog application that replaced an existing imperative solu…
this is a pretty interesting workflow. I was indeed thinking how one would integrate Souffle into a bigger application.
It illustrates how you can have the Souffle program load its data from SQLite databases, or how you can work with tuples and relations from Go.