Skip to content

Commit

Permalink
Merge pull request #6 from lang07123/master
Browse files Browse the repository at this point in the history
bugfix: train error when the slient_mode is True.
  • Loading branch information
linyiLYi authored Jun 1, 2023
2 parents 856da0b + 2f21a51 commit 9b81beb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main/snake_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ def step(self, action):
self.non_snake.remove((row, col))

else: # If game is over and the game is not in silent mode, play game over sound effect.
if len(self.snake) < self.grid_size:
self.sound_game_over.play()
else:
self.sound_victory.play()
if not self.silent_mode:
if len(self.snake) < self.grid_size:
self.sound_game_over.play()
else:
self.sound_victory.play()

# Add new food after snake movement completes.
if food_obtained:
Expand Down

0 comments on commit 9b81beb

Please sign in to comment.