File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -333,8 +333,6 @@ def set_screen_size(size: int):
333333pygame .display .set_caption ("Chess" )
334334pygame .display .set_icon (ICON )
335335
336- running = True
337-
338336ai_glob = False # if chess.py is "__main__" then this is the default it takes
339337
340338LIGHT : Color = 230 , 210 , 170
@@ -854,9 +852,11 @@ def handle_promotion(gamestate: GameState, ai_promoting=False):
854852print ("if you are running the exe, and can see this terminal, you are running a pre-release or a debug release." )
855853
856854def main (ai : bool | None = ai_glob ):
857- global running , ai_glob
855+ global ai_glob
858856 ai_glob = ai
859857 gamestate .reset ()
858+ running = True # local running flag
859+
860860 while running :
861861 for event in pygame .event .get ():
862862 if event .type == pygame .QUIT :
@@ -895,5 +895,6 @@ def main(ai: bool | None=ai_glob):
895895if __name__ == "__main__" :
896896 try :
897897 main (ai = ai_glob )
898- except pygame .error :
899- print ("pygame has been closed in another module or location." )
898+ except pygame .error as e :
899+ if str (e ) != "video system not initialized" :
900+ raise # re-raise any other errors
Original file line number Diff line number Diff line change 4848)
4949
5050clock : pygame .Clock = pygame .time .Clock ()
51- running : bool = True
51+
5252def main ():
53- global running
53+ running = True
5454 while running :
5555 time_delta = clock .tick (60 ) / 1000.0
5656
Original file line number Diff line number Diff line change 1010pygame .display .set_icon (ICON )
1111
1212clock : pygame .Clock = pygame .time .Clock ()
13- running : bool = True
1413
1514theme_file = chess .resource_path ("theme.json" )
1615manager = pygame_gui .UIManager ((chess .WIDTH , chess .HEIGHT ), theme_path = theme_file )
4948
5049
5150def main ():
52- global running
51+ running : bool = True
5352 while running :
5453 time_delta = clock .tick (60 ) / 1000.0
5554
You can’t perform that action at this time.
0 commit comments