1
0
www.mikescher.com/www/statics/programs/SharkSim_description.md

15 lines
1.0 KiB
Markdown
Raw Normal View History

2018-02-03 16:50:58 +01:00
SharkSim is my take on a Wa-Tor simulation ([wikipedia.org/wiki/Wator](https://wikipedia.org/wiki/Wator))
2017-11-08 17:39:50 +01:00
2018-02-03 16:50:58 +01:00
The rules of this [cellular automaton](https://en.wikipedia.org/wiki/Cellular_automaton) are:
2017-11-08 17:39:50 +01:00
> Time passes in discrete jumps, which I shall call chronons.
> During each chronon a fish or shark may move north, east, south or west to an adjacent point, provided the point is not already occupied by a member of its own species.
> A random-number generator makes the actual choice.
> For a fish the choice is simple: select one unoccupied adjacent point at random and move there.
> If all four adjacent points are occupied, the fish does not move.
> Since hunting for fish takes priority over mere movement, the rules for a shark are more complicated:
> from the adjacent points occupied by fish, select one at random, move there and devour the fish.
> If no fish are in the neighborhood, the shark moves just as a fish does, avoiding its fellow sharks.
My implementation is not that fancy - but it gets to a stable FPS rate of 45 with a map of the size 600x600.