Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ def byes():
def wide():
global runs
global extras
global bye_status
global noball_status
bye_status = False # Sets the bye status to false to let the code know to trigger the various events
noball_status = False # Sets the no-ball status to false to let the code know to trigger the various events
runs += 1
extras += 1

Expand All @@ -110,6 +114,8 @@ def noball():
global overs
global extras
global noball_status
global bye_status
bye_status = False # Sets the bye status to false to let the code know to trigger the various events
noball_status = True # Sets the no-ball status to true to let the code know to trigger the various events
runs += 1
extras += 1
Expand Down Expand Up @@ -150,6 +156,10 @@ def scoring(ballscore):

def add_wicket():
global wickets
global bye_status
global noball_status
bye_status = False # Sets the bye status to false to let the code know to trigger the various events
noball_status = False # Sets the no-ball status to false to let the code know to trigger the various events
if wickets < 10:
history.append((overs, runs, wickets, extras, noball_status, bye_status)) # Saves the current state of play before making any changes
wickets += 1
Expand All @@ -159,7 +169,10 @@ def add_wicket():

def add_ball():
global overs, runs, wickets, extras

global bye_status
global noball_status
bye_status = False # Sets the bye status to false to let the code know to trigger the various events
noball_status = False # Sets the no-ball status to false to let the code know to trigger the various events
history.append((overs, runs, wickets, extras, noball_status, bye_status)) # Appends the history list for the undo fucntion with the new ball

if overs % 1 == 0.5: # Uses the modulous operator to figure out the remainder of the overs
Expand Down Expand Up @@ -324,6 +337,7 @@ def toggle_bold(): # Function to toggle between regular and bold font

if bye_status:
draw_text("How many byes?", font, red, screen, 200, 50) # Asks the user how many byes were scored



draw_text(f"Run Rate: {round(run_rate, 2)}", font, black, screen, 50, 700) # Print the various calculations made
Expand Down