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

Function diag_win

Tic-Tac-Toe Games/tic-tac-toe4.py:59–65  ·  view source on GitHub ↗

Check if player has a complete diagonal.

(board: np.ndarray, player: int)

Source from the content-addressed store, hash-verified

57
58
59def diag_win(board: np.ndarray, player: int) -> bool:
60 """Check if player has a complete diagonal."""
61 if all(board[i, i] == player for i in range(3)):
62 return True
63 if all(board[i, 2 - i] == player for i in range(3)):
64 return True
65 return False
66
67
68def evaluate(board: np.ndarray) -> int:

Callers 1

evaluateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected