TicTacToe AI Making Incorrect Decisions

后端 未结 4 1188
攒了一身酷
攒了一身酷 2021-02-08 12:30

A little background: as a way to learn multinode trees in C++, I decided to generate all possible TicTacToe boards and store them in a tree such that the branch beginning at a n

4条回答
  •  被撕碎了的回忆
    2021-02-08 13:18

    Your existing algorithm is good, except you are forgetting one thing. Never choose any path where a move by the other player results in you being unable to at least tie.

    So basically, discard any branch where the players next move could result in an un-tieable situation and then run your existing algorithm. This results in the highest chance of winning against a non-perfect opponent, while removing the possibility of losing.

提交回复
热议问题