Efficient algorithm for counting unique states of tic tac toe

后端 未结 6 850
抹茶落季
抹茶落季 2021-02-07 12:51

I\'m trying to build a tic tac toe game to demonstrate and experiment with machine learning algorithms, and i\'ve found an interesting problem.

eg: a tic tac toe board c

6条回答
  •  花落未央
    2021-02-07 13:06

    If you care only about optimal moves:

    See this systematic map of optimal tic-tac-toe moves (http://xkcd.com/832/). You can use some (col, row) indexing to identify a particular state.

    If there is more than one equivalent state, use the "lowest" index (you have to define what "lowest" means; e.g. that (col,row) pair whose value 3*col+row is lowest) of all equivalent ones.

    Complete map of optimal tic-tac-toe moves

提交回复
热议问题