Пример #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            if ((button6.BackgroundImage == null) && (endState == false))
            {
                AddSign b6 = new AddSign(lastSign, button6);
                lastSign     = b6.GetSign();
                playField[5] = b6.GetSign();

                gameEnd = b6.checkWin(playField);
                if ((gameEnd == 'X') || (gameEnd == 'O') || (gameEnd == 'D'))
                {
                    EndOfGame();
                }

                if (vsAI == true)
                {
                    ai.AITurn();
                    lastSign = ai.GetLastSign();


                    if ((ai.GetGameEnd() == 'X') || (ai.GetGameEnd() == 'O') || (ai.GetGameEnd() == 'D'))
                    {
                        gameEnd = ai.GetGameEnd();
                        EndOfGame();
                    }
                }
            }
        }