Пример #1
0
        private void UndoMovement(Position from, Position to, Piece catchedPiece)
        {
            var piece = Board.RemovePiece(to);

            piece.ReduceNumberOfMovements();

            if (catchedPiece != null)
            {
                Board.PutPiece(catchedPiece, to);
                CatchedPieces.Remove(catchedPiece);
            }

            Board.PutPiece(piece, from);
        }
Пример #2
0
        private Piece ExecuteMovement(Position from, Position to)
        {
            var piece = Board.RemovePiece(from);

            piece.AddNumberOfMovements();

            var catchedPiece = Board.RemovePiece(to);

            if (catchedPiece != null)
            {
                CatchedPieces.Add(catchedPiece);
            }

            Board.PutPiece(piece, to);

            return(catchedPiece);
        }