I listened to a couple different podcasts where Francesco Cesarini talked about a college programing class covering Erlang where the students were assigned a project to model a world where
- Carrots grow on the board
- Rabbits travel around the board, eating carrots, and reproducing
- Wolves travel around eating rabbits and reproducing
I don't know if this is part of the story, but I also have
- Rabbits move towards carrots nearby
- Wolves move towards rabbits nearby
- Clone the repo
iex -S mix
CarrotWorldServer.sip
And the world starts printing to the terminal.
carrot_patch.ex, rabbit.ex, wolf.ex all have settings you can change like
rabbit.ex
@carrots_in_belly_before_reproduce 1
@day_can_live_without_carrots 10
wolf.ex
@rabbits_in_belly_before_reproduce 5
@day_can_live_without_rabbits 50
carrot_patch.ex
@carrot_growth_points_required 100
Look for start_in_production
and you can set the board_size
This software is released under the MIT Licence