Skip to content

Commit

Permalink
Merge 'Fix goal hint nondeterminism introduced by #2021' (#2030)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjohnson57 committed Jul 16, 2023
2 parents 5dfd0d2 + 7936e7a commit 742eb53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def get_goal_hint(spoiler: Spoiler, world: World, checked: set[str]) -> HintRetu

# Collect set of unhinted locations for the category. Reduces the bias
# from locations in multiple goals for the category.
location_reverse_map = defaultdict(set)
location_reverse_map = defaultdict(list)
for goal in goals:
if zero_weights or goal.weight > 0:
goal_locations = list(filter(lambda location:
Expand All @@ -641,7 +641,7 @@ def get_goal_hint(spoiler: Spoiler, world: World, checked: set[str]) -> HintRetu
goal.required_locations))
for location in goal_locations:
for world_id in location[3]:
location_reverse_map[location[0]].add((goal, world_id))
location_reverse_map[location[0]].append((goal, world_id))

if not location_reverse_map:
del world.goal_categories[goal_category.name]
Expand All @@ -651,8 +651,8 @@ def get_goal_hint(spoiler: Spoiler, world: World, checked: set[str]) -> HintRetu
else:
goals = goal_category.goals

location, goal_set = random.choice(list(location_reverse_map.items()))
goal, world_id = random.choice(list(goal_set))
location, goal_list = random.choice(list(location_reverse_map.items()))
goal, world_id = random.choice(goal_list)
checked.add(location.name)

# Make sure this wasn't the last hintable location for other goals.
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '7.1.150'
__version__ = '7.1.151'

# This is a supplemental version number for branches based off of main dev.
supplementary_version = 0
Expand Down

0 comments on commit 742eb53

Please sign in to comment.