Deterministic Game Rules


I added the first game rules. They are:

  1. Foxes will eat 1 adjacent rabbit if possible
  2. Foxes will move if they have no rabbits adjacent
  3. Rabbits will move to a safe adjacent square if they are currently next to a fox.

Each animal is processed sequentially. There is no randomness yet.

The neighbors calculation ended up being a big time-sink. I'd pulled in the jxxcarlson/elm-cell-grid library to help modeling the grid. Unfortunately it contained some bugs in its coordinate logic, causing the neighbors calculations to give wrong results around the edges of the grid. I ended up vendoring a patched file into the project for now.

Files

dist.zip 98 kB
Jun 07, 2020

Leave a comment

Log in with itch.io to leave a comment.