Skip to content

🗺 World Simulation Challenge - The world is inhabited by carrots, rabbits, and wolves.

License

Notifications You must be signed in to change notification settings

pH-7/carrots-rabbits-wolves

Repository files navigation

🐰 The Rabbits, Wolves, and Carrots' World 🐺

The world is inhabited by carrots, rabbits, and wolves! 🌎

World Problem

Rabbits would roam this world eating car- rots that grew in random patches. When they had eaten enough carrots, the rabbits would get fat and split in two. Wolves ran around eating up the rabbits; if they managed to catch and eat enough rabbits, they would also get fat and split. Rabbits and wolves within a certain distance of each other would broadcast information on food and predators. If a rabbit found a carrot patch, other rabbits would quickly join him. If a wolf found a rabbit, the pack would start chasing it.

Specification / Requirement

  • You will need to install NodeJS (v14 or newer) and npm on your machine for testing it (if it isn't the case).

How to run the project

  • At the location to which the project has been unzipped,
    • Run npm install to install the dependencies.
    • Then, run node src/cli.js (or just npm start).
    • See the results shown in the command line.
    • See the results in results.txt

Running unit tests

npm run test

Or with npx

npx ava

Simulation Results

Available in both results.txt and world-simulation-results.png files.

Early Simulation Graphic Results

Later Simulation Graphic Results

Happy Hunting! 🥕🐇🐺

License

Distributed under MIT license 🚀