>>> validate_moves([(1, 2), (-1, 0)], 3) Traceback (most recent call last): ... ValueError: Move is out of bounds for a matrix.
(moves: list[tuple[int, int]], size: int)
| 90 | |
| 91 | |
| 92 | def validate_moves(moves: list[tuple[int, int]], size: int) -> None: |
| 93 | """ |
| 94 | >>> validate_moves([(1, 2), (-1, 0)], 3) |
| 95 | Traceback (most recent call last): |
| 96 | ... |
| 97 | ValueError: Move is out of bounds for a matrix. |
| 98 | """ |
| 99 | for move in moves: |
| 100 | x, y = move |
| 101 | if not (0 <= x < size and 0 <= y < size): |
| 102 | raise ValueError("Move is out of bounds for a matrix.") |
| 103 | |
| 104 | |
| 105 | def parse_moves(input_str: str) -> list[tuple[int, int]]: |