Open William-Vigo opened 4 years ago
I agree that keeping track of parent pointers would work as well, but that's using the same amount of space for information that would only be used in this specific use case, where I need to count them. I prefer my implementation, where I create the space only when necessary.
https://github.com/angdav/cs435-p2/blob/7773ebbbc02f04d5968b58217efb4db4635591ad/p7.py#L64
Another way of retracing your steps would be by using parent pointers. Once you found the goal state just traverse the parents until you reach start or None