Skip to content

Instantly share code, notes, and snippets.

@puterleat
Created January 24, 2014 10:38
Show Gist options
  • Select an option

  • Save puterleat/8595192 to your computer and use it in GitHub Desktop.

Select an option

Save puterleat/8595192 to your computer and use it in GitHub Desktop.
def plan_goal(desired_outcome, environment, movie_of_my_plan=[]):
possibilities = filter(outcome_to_action_mapping, desired_outcome, environment)
sort(possibilities, key=magic_inverse_inference_function_which_includes_affordances)
best_bet = possibilities.pop()
if is_an_an_actionable_thing(best_bet):
movie_of_my_plan.append(best_bet)
if calculate_subjective_probability(desired_outcome) < 1:
return
else:
return plan_goal(best_bet, environment, movie_of_my_plan)
return plan_goal(desired_outcome, environment, movie_of_my_plan)
# plan the activity rather than do it now
plans = plan_goal("Attract a mate", "At the disco", [empty list... no plans as yet])
print plans
> ["Attract a mate", "Dance like a boss", "Buy drinks", "Start a fight", "Despair"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment