projectmesa / mesa-examples

Seminal agent-based models developed using Mesa
Other
105 stars 123 forks source link

Improve boid flocker model and documentation #101

Closed coderbeta1 closed 4 months ago

coderbeta1 commented 4 months ago

I have made the following changes:

  1. ReadMe Update: Many links in the readme were outdated due to change in folder structure. I have fixed it to work with current folders
  2. ReadMe Update: I have restructured the readme to make it similar to the readme of other examples. I have also added a link for additional information
  3. General readability: I have made general improvements by making the code more easy to read for newcomers
  4. Merge Agent and Model: I have deleted boid.py and merged it with model.py to follow best practices
  5. Renamed velocity: I have renamed the attribute "velocity" to "direction". Velocity is misleading since there is a speed attribute also and velocity is used to signify direction only in this case
  6. Model Visualization: I made it so that if there are 0 or 1 neighbours then the agent is red, else green. This help in better visual
  7. Sliders: I made it so that the user can now change the population and other parameters interactively

image

NOTE: I also tried to work on #86 for adding better visualization but I was facing some issues.

  1. As for colour I made a simple colouring scheme such that if there are less than 2 neighbours the agent is red, else green (Implemented)
  2. When I tried to make changes to the JavaScript file to add arrowHeads my changes were not being reflected. It did reflect initially, but later on it just did not reflect even the smallest change. I even deleted the entire JS file but the code still worked (it should not work without the JS file). It seemed like the python file was no longer dependent on the JavaScript file. I tried reinstalling mesa and retried but it did not work.
rht commented 4 months ago

pre-commit.ci autofix

rht commented 4 months ago

Except for the boid_draw performance measurement question, everything else LGTM.

rht commented 4 months ago

pre-commit.ci autofix

rht commented 4 months ago

Merged, thank you.