MCPcopy Create free account
hub / github.com/geekcomputers/Python / check_draw

Function check_draw

Tic-Tac-Toe Games/tic-tac-toe6.py:77–92  ·  view source on GitHub ↗

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]])

Source from the content-addressed store, hash-verified

75
76
77def 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
95def single_game(cur_player: str) -> str:

Callers 1

single_gameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected