/// <summary> /// Validates the origin position /// </summary> /// <param name="origin">Origin to validate</param> public void ValidateOriginPosition(Position origin) { if (!Board.IsPositionValid(origin)) { throw new BoardException($"Position {origin} is invalid."); } Piece piece = Board.Piece(origin); if (piece == null) { throw new BoardException("There is not a piece in this chosen position."); } if (piece.Color != CurrentPlayer) { throw new BoardException("This piece does not belong to you."); } if (piece.IsPieceStuck()) { throw new BoardException("This piece is stuck."); } }