Exemplo n.º 1
0
    def satisfiable_actions(
        self,
        state: State,
        victory_condition: Requirement,
    ) -> Iterator[Tuple[ResourceNode, int]]:

        interesting_resources = calculate_interesting_resources(
            self._satisfiable_requirements.union(
                victory_condition.as_set(
                    state.resource_database).alternatives), state.resources,
            state.energy, state.resource_database)

        # print(" > satisfiable actions, with {} interesting resources".format(len(interesting_resources)))
        for action, energy in self.possible_actions(state):
            for resource, amount in action.resource_gain_on_collect(
                    state.node_context()):
                if resource in interesting_resources:
                    yield action, energy
                    break
Exemplo n.º 2
0
 def _uses_trick(requirements: Requirement) -> bool:
     return any(
         criteria(individual)
         for individual in requirements.as_set(database).all_individual)