Ejemplo n.º 1
0
 public void PutChessPiece(Chessman chessman, Position position)
 {
     if (ChessmanAlreadyExists(position))
     {
         throw new ChessBoardException("Já existe uma peça nessa posição!");
     }
     ChessPieces[position.Row, position.Column] = chessman;
     chessman.PiecePosition = position;
 }
Ejemplo n.º 2
0
        public Chessman RemoveChessPiece(Position position)
        {
            if (ChessPiece(position) == null)
            {
                return(null);
            }
            Chessman chessman = ChessPiece(position);

            chessman.PiecePosition = null;
            ChessPieces[position.Row, position.Column] = null;
            return(chessman);
        }