Conversation
main.py
Outdated
| team2 = (GridBuilderStrat, SmarterRandomStrat, HorizontalStrat, ScoutStrat, RandomStrat) | ||
| DEBUG = False # Change this to True to get more detailed errors from ant strategies | ||
|
|
||
| # C. Create relevant error-handling measures |
There was a problem hiding this comment.
The section above the divider is for setup code that is modified before running the simulation--should the exceptions be further down below "Begin Game" with the other class definitions?
There was a problem hiding this comment.
yes - sounds good! I'll place them below the other class definitions.
main.py
Outdated
| NORTH_SYMS = ["A", "B", "C", "D", "E"] | ||
| SOUTH_SYMS = ["F", "G", "H", "I", "J"] | ||
| else: | ||
| raise AntCountError ("Teams do not have between 3 to 5 ants.") |
There was a problem hiding this comment.
I like that the game better handles varying team sizes.
It seems like ANTS_COUNT, NORTH_SYMS, and SOUTH_SYMS are now varying parameters and not constants, so I think it could be good design to merge this code into the game configuration functions. What do you think about refactoring to move this logic into generate_game_config and adding these three variables to the config dictionary?
Alternatively, NORTH_SYMS and SOUTH_SYMS could be constant lists of length 5 but at opposite ends of the alphabet, so that certain letters (like E) are always on the same team. Then, a config key 'ants_count' would tell you how much of each list to use
There was a problem hiding this comment.
Refactoring the logic sounds good. I'm more hesitant about having SOUTH_SYMS start from the end of the alphabet, as the indicator for the south anthill is already X, but NORTH_SYMS and SOUTH_SYMS could be the constant lists of ['A', 'B', 'C', 'D', 'E'] and ['F', 'G', 'H', 'I', 'J'] respectively instead.
There was a problem hiding this comment.
Good point about the anthill symbol
|
It seems odd to prompt teams for the number of ants in their team every game, if teams for the entire Antcode project are set in stone. However, I left some relevant code that does use this approach at the end of the 3+ ants colliding previously resulted in the program breaking due to referencing a nonexistent ant symbol. A future update will optimize the communication surrounding the collision ("Ants F, G, and H collided" as opposed to "Ants F and G collided / Ants F and H collided / Ants G and H collided"). |
|
There appears to be a rare edge case scenario where 3 ants colliding can result in another |
condense conflict messages, add clarifying notes about ant behavior, vision priority, and message passing, fix example code typo
…de into feature/varying-ant-teams
Allowing for increased flexibility in the number of ants per team, with more developed error handling for cases where (1) north and south teams don't have the same number of ants, and (2) there are too few or too many ants in a team.
Updated the docs accordingly.