def lambdas_to_plan(game, d): result = Network(game) for slot, term in d.items(): term = parse_lambda(term) term = binarize_term(term) term = unfold_numbers(term) result.add_goal(Goal(term, slot)) return result
def reuse_shit(self): assert self.current_goal is None prop = self.game.proponent terms = [goal.term for goal in self.goals] costs, _ = calc_costs_and_weights(*terms) for slot in slot_numbers_by_reachability: if prop.vitalities[slot] <= 0: continue value = prop.values[slot] if value == cards.I: continue # for speed shit = value_to_term(value) shit = unfold_numbers(shit) if shit in costs: access = (cards.get, number_term(slot)) if sequential_cost(access) < costs[shit]: if self.is_slot_available(slot): self.introduce_get(shit, access) del costs[shit]