nkremerh / sugarscape

Development repository for the Digital Terraria Lab implementation of the Sugarscape agent-based societal simulation.
https://github.com/digital-terraria-lab/sugarscape
MIT License
7 stars 11 forks source link

Consolidates redundant ethical score calculation code #26

Closed colinhanrahan closed 7 months ago

colinhanrahan commented 7 months ago

The only thing that changes between the 5 if statements in findBestEthicalCell is the actual ethics function being called. Everything else is the same, so it can be consolidated into one code block instead.

nkremerh commented 7 months ago

Similar to another of your PRs, this is a great idea which we put off for awhile as we finished up papers. This functionality has now been implemented with each decision model having its own class (each a child of the Agent class). The redundant code is now gone, and there is now one less place needed to be edited when adding in new decision models.