Skip to content

Commit

Permalink
The Witness: Fix non-deterministic hints (#2514)
Browse files Browse the repository at this point in the history
  • Loading branch information
NewSoupVi authored Dec 10, 2023
1 parent e2109db commit 8142564
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions worlds/witness/hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
]


def get_always_hint_items(world: "WitnessWorld"):
def get_always_hint_items(world: "WitnessWorld") -> List[str]:
always = [
"Boat",
"Caves Shortcuts",
Expand All @@ -187,17 +187,17 @@ def get_always_hint_items(world: "WitnessWorld"):
return always


def get_always_hint_locations(_: "WitnessWorld"):
return {
def get_always_hint_locations(_: "WitnessWorld") -> List[str]:
return [
"Challenge Vault Box",
"Mountain Bottom Floor Discard",
"Theater Eclipse EP",
"Shipwreck Couch EP",
"Mountainside Cloud Cycle EP",
}
]


def get_priority_hint_items(world: "WitnessWorld"):
def get_priority_hint_items(world: "WitnessWorld") -> List[str]:
priority = {
"Caves Mountain Shortcut (Door)",
"Caves Swamp Shortcut (Door)",
Expand Down Expand Up @@ -246,11 +246,11 @@ def get_priority_hint_items(world: "WitnessWorld"):
lasers.append("Desert Laser")
priority.update(world.random.sample(lasers, 6))

return priority
return sorted(priority)


def get_priority_hint_locations(_: "WitnessWorld"):
return {
def get_priority_hint_locations(_: "WitnessWorld") -> List[str]:
return [
"Swamp Purple Underwater",
"Shipwreck Vault Box",
"Town RGB Room Left",
Expand All @@ -264,7 +264,7 @@ def get_priority_hint_locations(_: "WitnessWorld"):
"Tunnels Theater Flowers EP",
"Boat Shipwreck Green EP",
"Quarry Stoneworks Control Room Left",
}
]


def make_hint_from_item(world: "WitnessWorld", item_name: str, own_itempool: List[Item]):
Expand Down Expand Up @@ -365,8 +365,8 @@ def make_hints(world: "WitnessWorld", hint_amount: int, own_itempool: List[Item]
remaining_hints = hint_amount - len(hints)
priority_hint_amount = int(max(0.0, min(len(priority_hint_pairs) / 2, remaining_hints / 2)))

prog_items_in_this_world = sorted(list(prog_items_in_this_world))
locations_in_this_world = sorted(list(loc_in_this_world))
prog_items_in_this_world = sorted(prog_items_in_this_world)
locations_in_this_world = sorted(loc_in_this_world)

world.random.shuffle(prog_items_in_this_world)
world.random.shuffle(locations_in_this_world)
Expand Down

0 comments on commit 8142564

Please sign in to comment.