File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -286,7 +286,7 @@ def ai_move():
286286 print (YELLOW + "⚠️ Line already taken!" + RESET )
287287 continue
288288 vertical_lines [row ][col ] = True
289- except :
289+ except ( IndexError , ValueError ) :
290290 print (RED + "❌ Position out of range!" + RESET )
291291 continue
292292
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def reset_game():
5151try :
5252 with open (highscore_path , "r" ) as file :
5353 high_score = int (file .read ())
54- except :
54+ except ( FileNotFoundError , ValueError ) :
5555 high_score = 0
5656
5757def inside (point ):
Original file line number Diff line number Diff line change @@ -35,15 +35,15 @@ def play_sound(sound_type):
3535 winsound .Beep (300 , 300 )
3636 elif sound_type == 'game_over' :
3737 winsound .Beep (200 , 600 )
38- except :
38+ except RuntimeError :
3939 pass
4040
4141def load_scores ():
4242 if os .path .exists ("math_quiz_scores.json" ):
4343 try :
4444 with open ("math_quiz_scores.json" , "r" ) as f :
4545 return json .load (f )
46- except :
46+ except ( FileNotFoundError , json . JSONDecodeError ) :
4747 pass
4848 return {"highest_score" : 0 , "longest_streak" : 0 }
4949
You can’t perform that action at this time.
0 commit comments