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

Function check_win

Tic-Tac-Toe Games/tic-tac-toe2.py:62–83  ·  view source on GitHub ↗

Evaluate the board and update the global Game status.

()

Source from the content-addressed store, hash-verified

60
61
62def check_win() -> None:
63 """Evaluate the board and update the global Game status."""
64 global Game
65 # Winning combinations
66 combos = [
67 (1, 2, 3),
68 (4, 5, 6),
69 (7, 8, 9),
70 (1, 4, 7),
71 (2, 5, 8),
72 (3, 6, 9),
73 (1, 5, 9),
74 (3, 5, 7),
75 ]
76 for a, b, c in combos:
77 if board[a] == board[b] == board[c] != " ":
78 Game = Win
79 return
80 if all(board[i] != " " for i in range(1, 10)):
81 Game = Draw
82 else:
83 Game = Running
84
85
86def main() -> None:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected