Пример #1
0
        private void Update_Tick(object sender, EventArgs e)
        {
            if (!game.GameIsEnded())
            {
                game.Draw();

                switch (game.WhoIsWon())
                {
                case Player.X:
                    game.EndGame();
                    MessageBox.Show("X");
                    break;

                case Player.O:
                    game.EndGame();
                    MessageBox.Show("O");
                    break;

                case Player.DRAW:
                    game.EndGame();
                    MessageBox.Show("DRAW");
                    break;
                }
            }
        }
Пример #2
0
        private void GameUpdate()
        {
            game.Draw();
            if (!game.GameIsEnded())
            {
                Player winner = game.WhoIsWon();

                if (winner != Player.NONE)
                {
                    game.EndGame();
                    Client.SendMessage("endGame;" +
                                       Client.GetSelectedGame() + ";" +
                                       winner);
                    turn.Text = "";
                    switch (winner)
                    {
                    case Player.X:
                        turn.Text = "Blue player wins!";
                        break;

                    case Player.O:
                        turn.Text = "Red player wins!";
                        break;

                    case Player.DRAW:
                        turn.Text = "Draw!";
                        break;
                    }
                }
            }
        }
Пример #3
0
        private void update_Tick(object sender, EventArgs e)
        {
            game.Draw();

            if (analysis.Checked)
            {
                diff.Enabled = true;
            }
            else
            {
                diff.Enabled = false;
            }
        }
Пример #4
0
        private void botField_MouseClick(object sender, MouseEventArgs e)
        {
            if (botGameIsPlaying)
            {
                botGameCopy = botGame.Clone();

                if (botGame.SetMark(new Point(e.X, e.Y), playerColor) == "ERROR")
                {
                    return;
                }

                CheckGameState();



                if (!botGame.GameIsEnded())
                {
                    String gameState = botGame.gameStateToString();
                    String botMove   = bot.NextMove(gameState);
                    Console.WriteLine(botMove);

                    botGame.SetMark(botMove);

                    CheckGameState();

                    if (analysis.Checked && botGameIsPlaying)
                    {
                        botGame.DisableAnalysis();
                        botGame.Draw();
                        String scores = bot.Analysis(botGame.gameStateToString());
                        botGame.EnableAnalysis(scores);
                    }
                }
                botGame.Draw();
            }
        }