I have a 2D grid where the path an object moves through the grid is determined by a loop.
Every loop cycle i calculate the next step based upon certail criterias and add the path (grid coords) to a list.
But in this loop i need to detect if the object is going in circles ( an popentially avoid an eternity loop ).
As I figure it this is "only" to discover if the last coordinate plus the one I'm about to add already exists after each other in the path list ?!?
But this seems as I on EVERY calculated new path coord have to go over the list from the beginning to check
for the coord combination and the list grows by every added coord making the operation slower over time.
Anyone know of any faster way to detect this circular movement?