public void ReplaceFigure(ChessFigurePosition position, ChessFigure figure) { if (this[position] != ChessFigure.None) { this[position] = figure; } else { throw new InvalidOperationException("There's no figure at this position."); } }
public void DeleteFigure(ChessFigurePosition position) { if (this[position] != ChessFigure.None) { this[position] = ChessFigure.None; } else { throw new InvalidOperationException("There are no chess figures at this position."); } }
public void MoveFigure(ChessFigurePosition position1, ChessFigurePosition position2) { this[position2] = this[position1]; this[position1] = ChessFigure.None; }
public ChessFigure this[ChessFigurePosition position] { get { return Array[position.Column - ChessFigurePosition.MIN_COLUMN, position.Row - ChessFigurePosition.MIN_ROW]; } set { Array[position.Column - ChessFigurePosition.MIN_COLUMN, position.Row - ChessFigurePosition.MIN_ROW] = value; } }