コード例 #1
0
        private void CheckForWin(string player)
        {
            if (board[0, 0].Equals(player) && board[0, 1].Equals(player) && board[0, 2].Equals(player))
            {
                popUp    = new PopUp($"Player {player} Wins!");
                gameOver = true;
            }
            if (board[1, 0].Equals(player) && board[1, 1].Equals(player) && board[1, 2].Equals(player))
            {
                popUp    = new PopUp($"Player {player} Wins!");
                gameOver = true;
            }
            if (board[2, 0].Equals(player) && board[2, 1].Equals(player) && board[2, 2].Equals(player))
            {
                popUp    = new PopUp($"Player {player} Wins!");
                gameOver = true;
            }

            if (board[0, 0].Equals(player) && board[1, 0].Equals(player) && board[2, 0].Equals(player))
            {
                popUp    = new PopUp($"Player {player} Wins!");
                gameOver = true;
            }
            if (board[0, 1].Equals(player) && board[1, 1].Equals(player) && board[2, 1].Equals(player))
            {
                popUp    = new PopUp($"Player {player} Wins!");
                gameOver = true;
            }
            if (board[0, 2].Equals(player) && board[1, 2].Equals(player) && board[2, 2].Equals(player))
            {
                popUp    = new PopUp($"Player {player} Wins!");
                gameOver = true;
            }

            if (board[0, 0].Equals(player) && board[1, 1].Equals(player) && board[2, 2].Equals(player))
            {
                popUp    = new PopUp($"Player {player} Wins!");
                gameOver = true;
            }
            if (board[0, 2].Equals(player) && board[1, 1].Equals(player) && board[2, 0].Equals(player))
            {
                popUp    = new PopUp($"Player {player} Wins!");
                gameOver = true;
            }
        }