tic tac toe [英] tic tac toe

查看:58
本文介绍了tic tac toe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何根据概率编程此游戏?比如第一次移动1/9的几率将是1/8的几率等等?或者我在哪里可以看到。我用谷歌搜索,我不认为我可以找到我正在寻找的

How can i program this game based on probability? like for first move 1/9 chances second would be1/8 chances and so forth? or where can i look into. ive googled around and i dont think i can find wht im lookin for

推荐答案

对于一个3x3的广场,只有很少的失败动作,否则游戏将始终以平局(除非你进行非强制移动或忽略一个线程)。
for a 3x3 square there are only very few losing moves, otherwise the game will always end with a draw (unless you make non-forcing move or ignore a thread).


@ 1051109210


概率不会给你带来多少收获;每次移动都会收集空单元格并均匀地随机选择其中一个单元格。很可能使用策略的玩家(记住引号)几乎每场比赛都输了。


另一种方法是:将棋盘视为三位数数字(例如0 ==空,1 ==玩家A,2 = =玩家B)。有效的移动将数字映射到另一个数字,例如第一步可以被描述为M(0)= 10000,即一个挂钩放在中间的单元格中。


如果你记下所有对(x,M(x) ))导致获胜或最佳游戏,你可以形成一个多项式P(x),发挥完美的井字游戏。一个简单的拉格朗日过程将为您提供(巨大的)多项式;-)


亲切的问候,


Jos
@1051109210
Probabilities don''t buy you much; for every move collect the empty cells and uniformly randomly select one of them. Chances are high that the player that uses that ''strategy'' (mind the quotes) loses (almost) every game.

Another approach is: consider the board as a trinary nine digit number (e.g. 0 == empty, 1 == player A, 2 == player B). A valid move maps a number to another number, e.g. a first move could be described as M(0) = 10000, i.e. a peg is put in the cell in the middle.

If you jot down all pairs (x, M(x)) that lead to a winning, or best game, you can form a polynomial P(x) that plays a perfect game of tic-tac-toe. A simple Lagrange process will give you that (huge) polynomial ;-)

kind regards,

Jos

有126种可能的游戏,用COMB(9,4)或COMB(9,5)获得。


游戏结束时,你会具有二进制九位数字(对于玩家A为0;对于玩家B为1),例如111010001将成为A的胜利案例。


写下这126个可能的游戏可以在Excel中轻松完成。只需写下从0到511的二进制文件(你可以从31开始,第一个案例有5个),并保留5个数字,这些是你可能的126个游戏。


现在你必须检查哪些是''获胜''数字。


在那些双赢的情况下...好吧让我们说玩家A获胜的时间的1/2第一名和1/2名队员B先获胜......但这只是'我不知道'的假设。


HTH
There are, 126 possible games, obtained with COMB(9,4) or COMB(9,5).

At the end of the game, you''ll have a binary nine digit number (0 for player A; 1 for player B), e.g. 111010001 will be a winning case for A.

Writing down this 126 possible games can be done easily in Excel. Just write the binaries from 0 to 511 (you can start in 31, the first case with 5 ones), and keep the numbers with 5 ones in them, those are your 126 possible games.

Now you have to check which ones are ''winning'' numbers.

In those cases where both win... well lets say 1/2 of the times Player A wins first and 1/2 Player B wins first.... but that''s just an ''i have no idea'' assumption.

HTH

这篇关于tic tac toe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆