by Péter Forgács - Lakeside Labs
(The purpose of this 'Hello World' project is for me to get some insight into Python's mesa package.)
- Needed Python packages:
mesa
numpy
matplotlib
- The following command in a command-line interface (like Terminal, Windows PowerShell) will install the packages:
pip install mesa numpy matplotlib
- After having the packages installed, the following command in a command-line editor (like Terminal, Windows PowerShell) will run the code:
mesa runserver
- After the previous command, the visual interface of the simulation is supposed to open automatically in a browser. In case of not opening automatically, just copy the link you can see in the command-line interface (for example: Interface starting at http://127.0.0.1:8521)
- In the browser, after the simulation interface is opened, in the upper right corner there is a Start button to start the simulation, and a Step button to propagate the simulation step-by-step.
It is possible to change some parameters of the simulation in the browser, where the simulation is being visualized. After changing a parameter other than the Frames Per Second parameter, a Reset is needed.
In the server.py
file it is possible to change the GRID_SIZE parameter to modify the number of rows and columns of the canvas
Have fun!
An Ant Colony Optimization (ACO) algorithm is used to find the coin.
The pheromone level of a cell
, where
Now based on the pheromone levels, the possible cells for the next step of an ant and Pacman will have different probabilities. The probability of the next possible cell
, where