Exemple #1
0
        private void ai_move()
        {
            ai.Running(game.Chess, game.WhoToMove);
            ai.GetNextStep(out int x, out int y);

            if (x < 0 || x > 14 || y < 0 || y > 14 || game.Chess[x, y] != 0)
            {
                // AI lose
            }


            game.BlackTimeThis   = 0;
            game.WhiteTimeThis   = 0;
            black_time_this.Text = "步时: 0秒";
            white_time_this.Text = "步时: 0秒";

            game.Move(x, y);

            Image    img = ChessBoard.Image;
            Graphics gra = Graphics.FromImage(img);

            switch (game.WhoToMove)
            {
            case 1:
                gra.FillEllipse(blackBrush, x * 50 + 15, y * 50 + 15, 30, 30);
                break;

            case 2:
                gra.FillEllipse(whiteBrush, x * 50 + 15, y * 50 + 15, 30, 30);
                break;
            }
            ChessBoard.Image = img;
        }