Exemple #1
0
        /************************************************************************/
        /*                 MOVE                              */
        /***********************************************************************/
        public static bool MakeMove(Move m)
        {
            int rowFrom, colFrom, rowDest, colDest;
            Piece p;
            NodeCount++;
            rowFrom = m.RowFrom;
            colFrom = m.ColFrom;
            rowDest = m.RowDest;
            colDest = m.ColDest;
            p = m.PieceDest;

            //if (Board.Position[m.RowDest, m.RowFrom].IsEmpty)
            //{
                //MaterialNumber[Player.Side,]
            //}
            Hdp++;
            Ply++;
            Game.ChangeTurn();
            return true;
        }
Exemple #2
0
        /// <summary>
        /// Di chuyển 1 quân cờ
        /// </summary>
        /// <param name="piece">con cờ</param>
        /// <param name="destination">vị trí đích</param>
        /// <returns>true nếu di chuyển thành công, ngược lại false</returns>
        /// <remarks>Đồng thời thêm vào Stack Undo</remarks>
        public bool MovePiece(ChessPiece piece, Point destination)
        {
            Move m = new Move(piece.Id, piece.Point, this.GetPoint(destination));

            if (piece.Move(destination, this))
            {
                StackUndo.Push(m);
                StackRedo.Clear();
                return true;
            }

            return false;
        }