Ejemplo n.º 1
0
 private void ValidateSourcePosition(Position sourcePosition)
 {
     if (!Board.ThereIsAPiece(sourcePosition))
     {
         throw new ChessException("There is no piece in source position.\n");
     }
     if (CurrentPlayer != ((ChessPiece)Board.GetPiece(sourcePosition)).Color)
     {
         throw new ChessException("The piece chosen is not yours.\n");
     }
     if (!Board.GetPiece(sourcePosition).IsThereAnyPossibleMove())
     {
         throw new ChessException("There is no possible movements for this piece.\n");
     }
 }