作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
查看(在 2 人游戏中)谁赢了 Tic Tac Toe 游戏的最佳方式是什么?现在我正在使用类似于以下内容的内容:
if (btnOne.Text == "X" && btnTwo.Text == "X" && btnThree.Text == "X")
{
MessageBox.Show("X has won!", "X won!");
return;
}
else
// I'm not going to write the rest but it's really just a bunch
// if statements.
那么如何摆脱多重 if 呢?
最佳答案
一些东西:
rowSum == 3 || columnSum == 3 || diagnolSum == 3
..?
关于c# - 检查 TicTacToe 中的赢家?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/740467/
我是一名优秀的程序员,十分优秀!