mirror of
https://github.com/jcreek/TheFarmerWasReplaced.git
synced 2026-07-15 03:53:45 +00:00
fix(*): Fix bug where mazes were not reset
This commit is contained in:
@@ -83,6 +83,16 @@ direction_index = 0
|
|||||||
|
|
||||||
treasure_not_yet_found = True
|
treasure_not_yet_found = True
|
||||||
|
|
||||||
|
def reset_state():
|
||||||
|
global visited_cells
|
||||||
|
global path_back
|
||||||
|
global direction_index
|
||||||
|
global treasure_not_yet_found
|
||||||
|
|
||||||
|
visited_cells = {}
|
||||||
|
path_back = []
|
||||||
|
direction_index = 0
|
||||||
|
treasure_not_yet_found = True
|
||||||
|
|
||||||
def record_current_cell_visited():
|
def record_current_cell_visited():
|
||||||
visited_cells[(get_pos_x(), get_pos_y())] = get_entity_type()
|
visited_cells[(get_pos_x(), get_pos_y())] = get_entity_type()
|
||||||
@@ -191,6 +201,9 @@ def backtrack_one_step():
|
|||||||
def navigate_maze():
|
def navigate_maze():
|
||||||
global treasure_not_yet_found
|
global treasure_not_yet_found
|
||||||
|
|
||||||
|
clear()
|
||||||
|
reset_state()
|
||||||
|
|
||||||
plant_maze()
|
plant_maze()
|
||||||
record_current_cell_visited()
|
record_current_cell_visited()
|
||||||
check_cell_for_treasure()
|
check_cell_for_treasure()
|
||||||
|
|||||||
Reference in New Issue
Block a user