Пример #1
0
        static public void Move(ChessBoard chessBoard)
        {
            WorthMovement ComputerMovement = Computer.MovementInfo(chessBoard);

            if (ComputerMovement.Source == null)
            {
                return;
            }

            int SourceIndexX      = ComputerMovement.Source.X / chessBoard.cells[0, 0].Size.Width;
            int SourceIndexY      = ComputerMovement.Source.Y / chessBoard.cells[0, 0].Size.Height;
            int DestinationIndexX = ComputerMovement.Destination.X / chessBoard.cells[0, 0].Size.Width;
            int DestinationIndexY = ComputerMovement.Destination.Y / chessBoard.cells[0, 0].Size.Height;

            ChessBoard.Chesspiece_Move(chessBoard.cells[SourceIndexX, SourceIndexY], chessBoard.cells[DestinationIndexX, DestinationIndexY], chessBoard);
            chessBoard.checkMate = chessBoard.CheckMate(chessBoard);
            if (chessBoard.checkMate)
            {
                chessBoard.showCheckMate(chessBoard.assassin, chessBoard.king);
            }
            chessBoard.MyTurn = !chessBoard.MyTurn;
            if (chessBoard.endGame())
            {
                return;
            }

            chessBoard.cells[SourceIndexX, SourceIndexY].FlatAppearance.BorderColor           = Color.Blue;
            chessBoard.cells[DestinationIndexX, DestinationIndexY].FlatAppearance.BorderColor = Color.Blue;
            //chessBoard.movementInfos.Add(chessBoard.saveMovementInfor(chessBoard.cells[SourceIndexX, SourceIndexY], chessBoard.cells[DestinationIndexX, DestinationIndexY]));
        }
Пример #2
0
        static public void Move(ChessBoard chessBoard)
        {
            WorthMovement ComputerMovement  = Computer.MovementInfo(chessBoard);
            int           SourceIndexX      = ComputerMovement.Source.X / chessBoard.cells[0, 0].Size.Width;
            int           SourceIndexY      = ComputerMovement.Source.Y / chessBoard.cells[0, 0].Size.Height;
            int           DestinationIndexX = ComputerMovement.Destination.X / chessBoard.cells[0, 0].Size.Width;
            int           DestinationIndexY = ComputerMovement.Destination.Y / chessBoard.cells[0, 0].Size.Height;

            chessBoard.movementInfos.Add(chessBoard.saveMovementInfor(chessBoard.cells[SourceIndexX, SourceIndexY], chessBoard.cells[DestinationIndexX, DestinationIndexY]));
            ChessBoard.Chesspiece_Move(chessBoard.cells[SourceIndexX, SourceIndexY], chessBoard.cells[DestinationIndexX, DestinationIndexY], chessBoard);
        }