mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Current setup of rules that revert back to generation. Currently has the issue of sphere 1 goal
This commit is contained in:
@@ -386,14 +386,18 @@ rules_dict: dict[str,list[list[str]]] = {
|
|||||||
|
|
||||||
|
|
||||||
access_rules_dict: dict[str,list[list[str]]] = {
|
access_rules_dict: dict[str,list[list[str]]] = {
|
||||||
"Whoville": None,
|
"Whoville": [
|
||||||
|
[]
|
||||||
|
],
|
||||||
"Post Office": [
|
"Post Office": [
|
||||||
["Who Cloak"]
|
["Who Cloak"]
|
||||||
],
|
],
|
||||||
"City Hall": [
|
"City Hall": [
|
||||||
["Rotten Egg Launcher"]
|
["Rotten Egg Launcher"]
|
||||||
],
|
],
|
||||||
"Countdown to X-Mas Clock Tower": None,
|
"Countdown to X-Mas Clock Tower": [
|
||||||
|
[]
|
||||||
|
],
|
||||||
"Who Forest": [
|
"Who Forest": [
|
||||||
["Who Forest Vacuum Access"],
|
["Who Forest Vacuum Access"],
|
||||||
# ["Progressive Vacuum Access": 1]
|
# ["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):
|
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):
|
old_rule = lambda state: True
|
||||||
return lambda state: True
|
if len(rule_set) < 1:
|
||||||
and_groups: list[set[str]] = []
|
return old_rule
|
||||||
for inner_list in rule_set:
|
else:
|
||||||
and_groups.append(set(inner_list))
|
old_rule = lambda state: False
|
||||||
|
for item_set in rule_set:
|
||||||
return lambda target_items_raw: (
|
logger.info("Rules to access: " + ";".join(item_set))
|
||||||
(target_items_set := set(target_items_raw)) and
|
old_rule = lambda state, items=item_set: state.has_all(items, player) or old_rule
|
||||||
player in target_items_set and
|
return old_rule
|
||||||
any(
|
|
||||||
all(item in target_items_set for item in and_group)
|
|
||||||
for and_group in and_groups
|
|
||||||
)
|
|
||||||
)
|
|
Reference in New Issue
Block a user