From 2c9fdaee107bd5a584db389e7ae4725c94c9dc35 Mon Sep 17 00:00:00 2001 From: Vincent Rodley Date: Fri, 1 Aug 2025 22:18:10 +1200 Subject: [PATCH] uses checkwin stub. slightly less yucky loops --- main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 7c6acaf..2b8f379 100644 --- a/main.py +++ b/main.py @@ -75,8 +75,7 @@ while playing: clear() printBoard(board) - tile = "" - while tile == "": + while True: try: chosenColumn = getIntInput(f"{colourTile(player)} where do you want to drop your tile? 0-6.\n>>> ") tile = board[chosenColumn].index("O") @@ -94,6 +93,12 @@ while playing: board[chosenColumn][tile] = player + if checkWin(board): + clear() + printBoard() + print(f"{colourTile(player)} won!") + break + if player == 'R': player = 'Y' else: