Check if the game is drawn (all positions filled). Args: player_pos: Dict of player positions (X and O) Returns: True if game is a draw, False otherwise >>> check_draw({"X": [1,2,3], "O": [4,5,6]}) False >>> check_draw({"X": [1,2,3,4,5], "O": [6,7,8,9]})
(player_pos: Dict[str, List[int]])
| 75 | |
| 76 | |
| 77 | def check_draw(player_pos: Dict[str, List[int]]) -> bool: |
| 78 | """ |
| 79 | Check if the game is drawn (all positions filled). |
| 80 | |
| 81 | Args: |
| 82 | player_pos: Dict of player positions (X and O) |
| 83 | |
| 84 | Returns: |
| 85 | True if game is a draw, False otherwise |
| 86 | |
| 87 | >>> check_draw({"X": [1,2,3], "O": [4,5,6]}) |
| 88 | False |
| 89 | >>> check_draw({"X": [1,2,3,4,5], "O": [6,7,8,9]}) |
| 90 | True |
| 91 | """ |
| 92 | return len(player_pos["X"]) + len(player_pos["O"]) == 9 |
| 93 | |
| 94 | |
| 95 | def single_game(cur_player: str) -> str: |