Check if the board position is empty. Args: b (List[str]): Board pos (int): Position 1-9 Returns: bool: True if empty, False if occupied. >>> b = [" "] * 10 >>> check_position(b, 1) True >>> b[1] = "X" >>> check_position(b, 1) False
(b: List[str], pos: int)
| 39 | |
| 40 | |
| 41 | def check_position(b: List[str], pos: int) -> bool: |
| 42 | """ |
| 43 | Check if the board position is empty. |
| 44 | |
| 45 | Args: |
| 46 | b (List[str]): Board |
| 47 | pos (int): Position 1-9 |
| 48 | |
| 49 | Returns: |
| 50 | bool: True if empty, False if occupied. |
| 51 | |
| 52 | >>> b = [" "] * 10 |
| 53 | >>> check_position(b, 1) |
| 54 | True |
| 55 | >>> b[1] = "X" |
| 56 | >>> check_position(b, 1) |
| 57 | False |
| 58 | """ |
| 59 | return b[pos] == " " |
| 60 | |
| 61 | |
| 62 | def check_win() -> None: |