Raise IndexError in get_piece for negative indices
Simplified calculation of castling rights