コード例 #1
0
        bool WinningCheck()
        {
            if (Xs == true)
            {
                CurrentPlayer = p1Way;
            }
            else
            {
                CurrentPlayer = p2Way;
            }

            for (int i = 0; i < 8; i++)
            {
                if ((CurrentPlayer.Contains(winningPos[i, 0])) && (CurrentPlayer.Contains(winningPos[i, 1])) && (CurrentPlayer.Contains(winningPos[i, 2])))
                {
                    if (Xs == true)
                    {
                        message = "X won!";
                        OutField();
                    }
                    else
                    {
                        message = "O won!";
                        OutField();
                    }
                    return(true);
                }
            }
            return(false);
        }