Beispiel #1
0
 private void BotMove(Bot bot, Bot Other)
 {
     int[]         move = bot.Play(game);
     XO.Game.State s    = game.play(move[0], move[1], turn);
     if (s == 0)
     {
         MessageBox.Show("Try Again!");
     }
     else
     {
         MarkLabel(move[0], move[1]);
         if (s == Game.State.Win)
         {
             Console.WriteLine(bot.ToString() + " Win!");
             bot.FeedBack(s);
             if (play)
             {
                 Other.FeedBack(0);
             }
             ResetGame();
         }
         else if (s == Game.State.Draw)
         {
             Console.WriteLine("Draw!");
             bot.FeedBack(s);
             if (play)
             {
                 Other.FeedBack(s);
             }
             ResetGame();
         }
         NextTrun();
     }
 }
Beispiel #2
0
        private void Play(int x, int y, object sender)
        {
            XO.Game.State s = game.play(x, y, turn);
            if (s == 0)
            {
                MessageBox.Show("Try Again!");
            }
            else
            {
                MarkLabel(x, y);
                if (s == Game.State.Win)
                {
                    MessageBox.Show("I Win!");
                    bot2.FeedBack(0);
                    ResetGame();
                }
                else if (s == Game.State.Draw)
                {
                    MessageBox.Show("Draw!");
                    bot2.FeedBack(s);
                    ResetGame();
                }
                else
                {
                    NextTrun();

                    BotMove(bot2, bot1);
                }
            }
        }