From 7f3a535bf5e898f4412d6606e0c216aeb2d3a3e8 Mon Sep 17 00:00:00 2001 From: AlexCami1902 Date: Thu, 8 May 2025 09:21:30 +1000 Subject: [PATCH] Update main.py Fixed critical error where the innings did not end upon the completion of 20 overs Signed-off-by: AlexCami1902 --- main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 4a00ba8..11306bd 100644 --- a/main.py +++ b/main.py @@ -146,7 +146,6 @@ def end_game(): pygame.quit() def scoring(ballscore): - print("Button clicked") global runs global bye_status global extras @@ -295,6 +294,9 @@ def toggle_bold(): # Function to toggle between regular and bold font while True: # If it's the second innings, set the required score to the runs scored by team 1 then add 1 to win + if overs == 20: + read_score() + if overs < 1: run_rate = 0 else: @@ -302,7 +304,10 @@ def toggle_bold(): # Function to toggle between regular and bold font if run_rate > 36: run_rate = 36 if overs % 1 == 0: - predicted = (run_rate * (20 - numpy.round(overs, 1)))+runs # Calculates the projected total at the end of every over + if run_rate >= 36: + run_rate = 36 + else: + predicted = (run_rate * (20 - numpy.round(overs, 1)))+runs # Calculates the projected total at the end of every over final_score = state["last"] if innings == 2: