if (sq1 + sq2 + sq3 == 0) { win0 = 1; win = 0; } else if (sq4 + sq5 + sq6 == 0) { win0 = 2; win = 0; } else if (sq7 + sq8 + sq9 == 0) { win0 = 3; win = 0; } else if (sq1 + sq4 + sq7 == 0) { win0 = 4; win = 0; } else if (sq2 + sq5 + sq8 == 0) { win0 = 5; win = 0; } else if (sq3 + sq6 + sq9 == 0) { win0 = 6; win = 0; } else if (sq1 + sq5 + sq9 == 0) { win0 = 7; win = 0; } else if (sq3 + sq5 + sq7 == 0) { win0 = 8; win = 0; } //若win=1,那么玩家赢 else if (sq1 + sq2 + sq3 == 3) { winx = 1; win = 1; } else if (sq4 + sq5 + sq6 == 3) { winx = 2; win = 1; } else if (sq7 + sq8 + sq9 == 3) { winx = 3; win = 1; } else if (sq1 + sq4 + sq7 == 3) { winx = 4; win = 1; } else if (sq2 + sq5 + sq8 == 3) { winx = 5; win = 1; } else if (sq3 + sq6 + sq9 == 3) { winx = 6; win = 1; } else if (sq1 + sq5 + sq9 == 3) { winx = 7; win = 1; } else if (sq3 + sq5 + sq7 == 3) { winx = 8; win = 1; } else if (sq1 + sq2 + sq3 + sq4 + sq5 + sq6 + sq7 + sq8 + sq9 == 5) { win = 2;//游戏 } else { win = 99; } 在flash中是什么意思
时间: 2024-04-07 19:32:25 浏览: 125
IDEFixPak6.0 (2009,2010,XE,XE1,XE2,XE3,XE4,XE5,XE6,XE7,XE8,10,10.1,10.2 )
5星 · 资源好评率100%
这段代码是一个井字棋游戏的判断胜负的部分。sq1到sq9表示棋盘上的九个格子,值为1表示玩家下的是圆圈,值为0表示玩家下的是叉。代码中通过计算每一行、每一列和每一条对角线上的值来判断是否有一方获胜,若有则会将win变量赋值为0或1,表示玩家或电脑获胜。当所有格子都下满但没有一方获胜时,win变量赋值为2,表示平局。若出现其他情况,则win变量赋值为99。
阅读全文