public void undoMovement(Position origin, Position destiny, Piece pieceCaptured) { Piece p = Board.removePiece(destiny); p.decrementMovementsCount(); if (pieceCaptured != null) { Board.putPiece(pieceCaptured, destiny); caught.Remove(pieceCaptured); } Board.putPiece(p, origin); }
public Piece executeMovement(Position origin, Position destiny) { Piece p = Board.removePiece(origin); p.incrementMovementsCount(); Piece pieceCaptured = Board.removePiece(destiny); Board.putPiece(p, destiny); if (pieceCaptured != null) { caught.Add(pieceCaptured); } return(pieceCaptured); }