Order of operations optimization Ants became blocked by other ants. If it was to cycle through and move which ant was available, then cycle again… that would come to O(!n) complexity. My Goal was to reduce it to O(n). All ants were cycled and marked an ant that they were waiting on, after every ant was cycled through once, the ant that could move would move, and then ants waiting on that ant would move, and it would cycle down like that.
Ants at intersections would be biased to which lanes would go (always the south or etc). So every update, the biased favored direction would rotate (North->East->South->West->North..) So a full intersection would allow fair processing. If the direction was not waited on (For example, bias was set to east, but ant 3 was not there). Then it would find the next in the rotation, South. |
Graphics rendering and Optimization.The entire map was boxed and dynamically loaded as ants explored areas.
Different options to turn certain UI on and off (grid mode, ant food levels, current states) and etc were implemented Render custom software, and layered drawing created Looking back, how I would change itMore of a focus on creating the UI aspect for programming the AI. Since it would have made testing and debugging simpler.
Create it in Unity instead of C++. From this project and a few others, I became quite comfortable with C++. But for building a project solo, the time saved on the graphics renderer and animations with Unity would have been huge. Internal handling of Turing machine. I had yet to become in love with Vectors and Dictionaries as much as I am now. Would have been more organized to have a Dictionary<int(currentState),Dictionary<int(pherSmelt),Stack<ActionsToPreform>>> while having the ActionsToPreform be a stack of Delegate functions. A visual list of Actions could be on a side tool bar, to be dragged and dropped into the stack |