From cb2c99c3693bea32f5b2a07b1411d8cf4bec88e8 Mon Sep 17 00:00:00 2001 From: Vincent Rodley Date: Fri, 1 Aug 2025 11:05:19 +1200 Subject: [PATCH] can no longer override in a full column. need to fix non integer inp --- main.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 94a6e3b..8dce86c 100644 --- a/main.py +++ b/main.py @@ -31,7 +31,7 @@ def printBoard(board): for i in range(6): row = "" for column in board: - row += "|" + column[i] + row += "| " + column[i] + " " row += "|" rows.append(row) @@ -41,7 +41,7 @@ def printBoard(board): for row in rows: toPrint += (row + "\n") - print(f"===============\n{toPrint[:-1]}\n===============") + print(f"=============================\n{toPrint[:-1]}\n=============================") def getIntInput(prompt): success = False @@ -77,18 +77,20 @@ turn = 'R' while playing: clear() + printBoard(board) - chosenColumn = getIntInput(f"{turn} where do you want to drop your tile? 1-7.\n>>> ") - - try: - tile = findLowest(board, chosenColumn) - except ValueError: - print("You chose a column that is full. Try again") + tile = "" + while tile == "": + try: + chosenColumn = getIntInput(f"{turn} where do you want to drop your tile? 0-6.\n>>> ") + tile = findLowest(board, chosenColumn) + break + except ValueError: + print("You chose a column that is full. Try again") + clear() + printBoard(board) + tile = "" board[chosenColumn][tile] = turn - printBoard(board) - - input() - turn = 'Y' if turn == 'R' else 'R'