From 11fa7f71ef0d5c417d1cc20814fbff954966f329 Mon Sep 17 00:00:00 2001 From: mryouse Date: Thu, 7 May 2020 01:48:07 +0000 Subject: bugfix -- new and restarted games should be the same size as the previous game --- sweepy.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sweepy.py b/sweepy.py index bc173f5..0a3f635 100755 --- a/sweepy.py +++ b/sweepy.py @@ -38,6 +38,9 @@ def env_setup(): def game_loop(stdscr, ob, ml): + game_width = ml.WIDTH + game_height = ml.HEIGHT + game_bombs = ml.BOMBS cur_y, cur_x = ml.get_first_cell() while(True): @@ -66,14 +69,14 @@ def game_loop(stdscr, ob, ml): stdscr.clrtoeol() ml = MinesweeperLogic() - ml.new_game() + ml.new_game(game_width, game_height, game_bombs) cur_y, cur_x = ml.get_first_cell() break elif ik == 'r': stdscr.move(4, 3) stdscr.clrtoeol() - ml.new_game() + ml.new_game(game_width, game_height, game_bombs) cur_y, cur_x = ml.get_first_cell() break @@ -119,7 +122,7 @@ def game_loop(stdscr, ob, ml): if choice == 'y': ml = MinesweeperLogic() - ml.new_game() + ml.new_game(game_width, game_height, game_bombs) cur_y, cur_x = ml.get_first_cell() # reset the current game with the "r" key @@ -131,7 +134,7 @@ def game_loop(stdscr, ob, ml): stdscr.clrtoeol() if choice == 'y': - ml.new_game() + ml.new_game(game_width, game_height, game_bombs) cur_y, cur_x = ml.get_first_cell() # quit without saving using the "q" key -- cgit v1.2.3