Current setup of rules that revert back to generation. Currently has the issue of sphere 1 goal

This commit is contained in:
MarioSpore
2025-07-29 00:55:06 -04:00
parent 64cca7fff9
commit b622953cd0

View File

@@ -386,14 +386,18 @@ rules_dict: dict[str,list[list[str]]] = {
access_rules_dict: dict[str,list[list[str]]] = {
"Whoville": None,
"Whoville": [
[]
],
"Post Office": [
["Who Cloak"]
],
"City Hall": [
["Rotten Egg Launcher"]
],
"Countdown to X-Mas Clock Tower": None,
"Countdown to X-Mas Clock Tower": [
[]
],
"Who Forest": [
["Who Forest Vacuum Access"],
# ["Progressive Vacuum Access": 1]
@@ -445,29 +449,13 @@ access_rules_dict: dict[str,list[list[str]]] = {
}
# def interpret_rule(rule_set: list[list[str]], player: int):
# old_rule = lambda state: True
# if len(rule_set) < 1:
# return old_rule
# else:
# old_rule = lambda state: False
# for item_set in rule_set:
# logger.info("Rules to access: " + ";".join(item_set))
# old_rule = lambda state: state.has_all(item_set, player) or old_rule
# return old_rule
def interpret_rule(rule_set: list[list[str]], player: int):
if not rule_set or all(not inner_list for inner_list in rule_set):
return lambda state: True
and_groups: list[set[str]] = []
for inner_list in rule_set:
and_groups.append(set(inner_list))
return lambda target_items_raw: (
(target_items_set := set(target_items_raw)) and
player in target_items_set and
any(
all(item in target_items_set for item in and_group)
for and_group in and_groups
)
)
old_rule = lambda state: True
if len(rule_set) < 1:
return old_rule
else:
old_rule = lambda state: False
for item_set in rule_set:
logger.info("Rules to access: " + ";".join(item_set))
old_rule = lambda state, items=item_set: state.has_all(items, player) or old_rule
return old_rule