fix(generation): reduce memory usage for bunny walk calculations

fix(key logic): make partial the default
This commit is contained in:
aerinon
2023-12-28 17:22:36 -07:00
parent 156f223829
commit d44ac89faf
4 changed files with 11 additions and 5 deletions

View File

@@ -149,7 +149,7 @@ class World(object):
set_player_attr('door_self_loops', False) set_player_attr('door_self_loops', False)
set_player_attr('door_type_mode', 'original') set_player_attr('door_type_mode', 'original')
set_player_attr('trap_door_mode', 'optional') set_player_attr('trap_door_mode', 'optional')
set_player_attr('key_logic_algorithm', 'default') set_player_attr('key_logic_algorithm', 'partial')
set_player_attr('shopsanity', False) set_player_attr('shopsanity', False)
set_player_attr('mixed_travel', 'prevent') set_player_attr('mixed_travel', 'prevent')
@@ -1158,7 +1158,7 @@ class CollectionState(object):
or self.has('Ice Rod', player) or self.has('Ice Rod', player)
or self.has('Cane of Somaria', player) or self.has('Cane of Somaria', player)
or self.has('Cane of Byrna', player)) or self.has('Cane of Byrna', player))
def can_hit_crystal_through_barrier(self, player): def can_hit_crystal_through_barrier(self, player):
return (self.can_use_bombs(player) return (self.can_use_bombs(player)
or self.can_shoot_arrows(player) or self.can_shoot_arrows(player)

2
CLI.py
View File

@@ -216,7 +216,7 @@ def parse_settings():
'intensity': 2, 'intensity': 2,
'door_type_mode': 'original', 'door_type_mode': 'original',
'trap_door_mode': 'optional', 'trap_door_mode': 'optional',
'key_logic_algorithm': 'default', 'key_logic_algorithm': 'partial',
'decoupledoors': False, 'decoupledoors': False,
'door_self_loops': False, 'door_self_loops': False,
'experimental': False, 'experimental': False,

View File

@@ -109,6 +109,9 @@ These are now independent of retro mode and have three options: None, Random, an
# Bug Fixes and Notes # Bug Fixes and Notes
* 1.2.0.23u
* Generation: fix for bunny walk logic taking up too much memory
* Key Logic: Partial is now the new default
* 1.2.0.22u * 1.2.0.22u
* Flute can't be activated in rain state (except glitched modes) (Thanks codemann!) * Flute can't be activated in rain state (except glitched modes) (Thanks codemann!)
* ER: Minor fix for Link's House on DM in Insanity (escape cave should not be re-used) * ER: Minor fix for Link's House on DM in Insanity (escape cave should not be re-used)

View File

@@ -1891,14 +1891,16 @@ def set_bunny_rules(world, player, inverted):
# a) being able to reach it, and # a) being able to reach it, and
# b) being able to access all entrances from there to `region` # b) being able to access all entrances from there to `region`
queue = deque([(region, [], {region})]) queue = deque([(region, [], {region})])
seen_sets = set([frozenset({region})])
while queue: while queue:
(current, path, seen) = queue.popleft() (current, path, seen) = queue.popleft()
for entrance in current.entrances: for entrance in current.entrances:
new_region = entrance.parent_region new_region = entrance.parent_region
if new_region.type in (RegionType.Cave, RegionType.Dungeon) and new_region in seen: new_seen = seen.union({new_region})
if new_region.type in (RegionType.Cave, RegionType.Dungeon) and new_seen in seen_sets:
continue continue
new_path = path + [entrance.access_rule] new_path = path + [entrance.access_rule]
new_seen = seen.union({new_region}) seen_sets.add(frozenset(new_seen))
if not is_link(new_region): if not is_link(new_region):
if world.logic[player] == 'owglitches': if world.logic[player] == 'owglitches':
if region.type == RegionType.Dungeon and new_region.type != RegionType.Dungeon: if region.type == RegionType.Dungeon and new_region.type != RegionType.Dungeon:
@@ -1935,6 +1937,7 @@ def set_bunny_rules(world, player, inverted):
else: else:
continue continue
if is_bunny(new_region): if is_bunny(new_region):
# todo: if not owg or hmg and entrance is in bunny_impassible_doors, then skip this nonsense?
queue.append((new_region, new_path, new_seen)) queue.append((new_region, new_path, new_seen))
else: else:
# we have reached pure light world, so we have a new possible option # we have reached pure light world, so we have a new possible option