I\'m having a huge block trying to understand \"trees\" while making a Tic-Tac-Toe bot. I understand the concept, but I can\'t figure out to implement them.
Can someone
I don't think you need to keep a tree in memory. You simply need to implement a recursive function that works something like:
Move getBestMove(Board state, boolean myTurn)
Then you simply recurse until you've reached a winning, losing or draw-state.
The call-stack would over time look like a tree if you drew it on paper. You should return the move that leads to a node at which the opponent (definitely / most likely) looses (even though he also plays using getBestMove)
For a state-space as little as tic-tac-toe however, you could simply do a full look-up-table with the best moves! :-)