2

I made a tic tac toe A.I. Given each board state, my A.I. will return 1 exact place to move. (Even if moves are equally correct, it chooses same one every time, it does not pick a random one)

I also made a function that loops though all possible plays made with the A.I.

So it's a recursive function that lets the A.I. make a move for a given board, then lets the other play make all possible moves and calls the recursive function in it self with a new board for each possible move.

I do this for when the A.I goes first, and when the other one goes first... and add these together. I end up with 418 possible wins and 115 possible ties, and 0 possible loses.

But now my problem is, how do I maximize the amount of wins? I need to compare this statistic to something, but I can't figure out what to compare it to.

4

3 回答 3

5

你读过维基百科上的文章吗?关联

端子位置数

仅考虑板的状态,并考虑板的对称性(即旋转和反射)后,端子板位置只有 138 个。假设 X 每次都先走一步:

  • (X) 赢得了 91 个独特的位置
  • (O) 赢得了 44 个独特的位置
  • 绘制了 3 个独特的位置

可能的游戏数量

在不考虑对称性的情况下,可以使用导致 255,168 种可能游戏的精确公式手动确定可能游戏的数量。假设 X 每次都先走一步:

  • (X) 赢得了 131,184 场已完成的比赛
  • (O) 赢得了 77,904 场已完成的比赛
  • 抽出 46,080 场完赛

您可以从第一段生成 138 个端子板位置

或者

你可能会在随机字段上运行足够的测试,并将您的结果与此处链接的统计数据进行比较

Win in 5 moves    1440     0.6%
Win in 6 moves    5328     2.1%
Win in 7 moves    47952   18.8%
Win in 8 moves    72576   28.4%
Win in 9 moves    81792   32.1%
Draw              46080   18.1%    
Total             255168 100.0%
于 2012-12-01T23:40:55.757 回答
0

你实际上可以暴力破解游戏,并证明每次有获胜策略时,你的 AI 都会选择正确的动作。然后,您可以证明,对于每个位置,您的 AI 都会选择能够最大限度地提高获胜策略机会的走法,假设其他玩家随机下棋。没有那么多可能性,所以你应该能够消除所有这些。

您还可以通过假设其他玩家实际上稍微聪明,例如总是试图阻止导致立即获胜的移动来显着减少可能性空间。

于 2012-12-01T23:58:21.390 回答
0

akaRem 回答的一个问题是,最佳玩家不应该看起来像整体分布。例如,我刚写的一个玩家在大约 90% 的时间里赢了一个随机玩的玩家,并且有 10% 的时间打成平手。如果您有两名玩家随机比赛,您应该只期望 akaRem 的统计数据匹配。两个最佳玩家总是会打成平手。

于 2013-08-26T02:29:43.610 回答