From a7b161f128541b6c266365ef125d7490706d84d1 Mon Sep 17 00:00:00 2001 From: bpot Date: Fri, 1 May 2026 11:11:09 -0400 Subject: [PATCH] it works --- ttt/game.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ttt/game.py b/ttt/game.py index 2f0e302..6b30a32 100644 --- a/ttt/game.py +++ b/ttt/game.py @@ -58,4 +58,17 @@ class TTTGame: def check_winner(self, state, symbol): "Checks whether the player with `symbol` has won the game." + winner = [ + (0,1,2), + (3,4,5), + (6,7,8), + (0,3,6), + (1,4,7), + (2,5,8), + (0,4,8), + (2,4,6)] + for combo in winner: + if state["board"][combo[0]] == symbol: + if state["board"][combo[0]] == state["board"][combo[1]] == state["board"][combo[2]]: + return True return False