//Methods To do public void MakeMove(Move move) { Piece p = grid[move.GetSourcePoint().X - 1, move.GetSourcePoint().Y - 1].GetPiece(); grid[move.GetSourcePoint().X - 1, move.GetSourcePoint().Y - 1].RemovePiece(); if (grid[move.GetDestinationPoint().X - 1, move.GetDestinationPoint().Y - 1].IsOccuppied()) { move.SetEatenPiece(grid[move.GetDestinationPoint().X - 1, move.GetDestinationPoint().Y - 1].GetPiece()); } grid[move.GetDestinationPoint().X - 1, move.GetDestinationPoint().Y - 1].SetPiece(p); grid[move.GetDestinationPoint().X - 1, move.GetDestinationPoint().Y - 1].GetPiece().SetPosition(move.GetDestinationPoint()); }
public void UndoMove(Move move) { MakeMove(new Move(move.GetDestinationPoint(), move.GetSourcePoint())); if (move.GetEatenPiece() != null) { grid[move.GetDestinationPoint().X - 1, move.GetDestinationPoint().Y - 1].SetPiece(move.GetEatenPiece()); } }