protected string ConvertFigure(Chessman chessman) { switch (chessman?.GetType().Name) { case nameof(Bishop): return(Figure.Bishop); case nameof(King): return(Figure.King); case nameof(Queen): return(Figure.Queen); case nameof(Rook): return(Figure.Rook); case nameof(Pawn): return(Figure.Pawn); case nameof(Knight): return(Figure.Knight); default: return(null); } }
public void RemoveChessman(Chessman chessman) { var figures = chessman.GetColor() == Color.White ? _whiteFigures : _blackFigures; if (!figures.Remove(chessman)) { throw new RemoveChessmanException($"{chessman.GetColor()} {typeof(Chessman)} not found on the board"); } }
public void SetChessman(string location, Chessman chessman) { _board[location] = chessman; }