Hacker News new | ask | show | jobs
by LeifCarrotson 1655 days ago
> What tripped me up every time is that most board games have a lot of "if this happens, there is this specific rule that applies". Even relatively simple games (like Homeworlds) are pretty hard to nail down perfectly due to all the special cases.

The key is to build a data-driven state machine, rather than writing logic with a bunch of 'if' statements.

2 comments

You are correct, but some games can yield exceptionally complicated state machines.

I designed a language for solving this: http://www.adama-lang.org/

I get all the benefits of a data driven state machine with the simplicity of a language that supports asynchronously asking users for updates.

I am "camp Haskell", so my approach was pretty much data-driven. But what is a state machine if not a big nest of if-else statements? :-)