-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Hit as part of #376 .
+@lanctot +@michalsustr +@finbarrtimbers
The implementation of GetAllStates expects that state->ToString() be unique for states, which is not true. For example, in the Battleship game, ToString() returns an ascii art representation of the player boards. In Go, my understanding is that ToString() renders the Go board (edit see also this discussion). Neither of these mappings are injective: different orders of moves can result in the same boards, and therefore the same ToString().
This results in the method failing to explore the full game tree. Since the method is performing a DFS on a tree, it is impossible to hit the same state twice, so I am not sure what the comment add only if not already present was supposed to catch. I suggest the following:
- If we want to keep the map, we should have histories as key.
- There is no need to keep an expensive map: a vector of (unique) pointers to states would be more efficient and simplify the code even further. I'm not sure how breaking a change that would be though?