- Updated Tuesday, May 16th 2017 @ 12:22:28
This question may seem dumb but I'm really new to Artificial Intelligence... In the context of a AI course that I'm attending, I have been tasked to code an agent for any one of the projects available here , so I picked four in a row which seemed the simplest of all. I know that I have to have a tree with the future states of the board in order to use a search algorithm (e.g. minmax algorithm with alpha beta pruning) to find the best move . But how can I create the state tree ?
- Created Wednesday, May 17th 2017 @ 12:47:56
There are mainly two ways to do this :
The first one is to create a copy of the board, play your move on that copy of the board, then (when you reach a terminal node) evaluate the board. After use, you discard that copy. pros : allows multithreading, etc. cons : is slow if your copy is slow, uses a lot of memory (size of your board * brachingfactor^depth)
The other one is to have only one board, and then play a move on it, do it again until you reach a terminal node. Then evaluate that node. Then undo the last node, do another one. then undo that move and do another one until you have explored all the "brothers" of the first node. Then you undo two move, and do it again. It may seems really complicated like this, but it's actually really easy to do with recursion. pros : uses very little memory (only one board), cons : no multithread
- Created Thursday, May 18th 2017 @ 10:12:37
Thanks for the answer ! I'll try to do it with the first way that you describe as it sounds a bit simpler...
- Created Thursday, May 18th 2017 @ 17:02:47
It might sound simpler, but be wary with the behaviour of your objects on copy (as the opposite of reference). The second method is actually passing the board as a reference, that's what my bot uses.