Skip to content

Instantly share code, notes, and snippets.

@stuntgoat
Created February 27, 2013 02:13
Show Gist options
  • Save stuntgoat/5044357 to your computer and use it in GitHub Desktop.
Save stuntgoat/5044357 to your computer and use it in GitHub Desktop.
class Search(object):
def __init__(self, state, *args, **kwargs):
self.state = state
self.cost_func = None
def actions(self):
"""
Returns a set of actions.
"""
pass
def transition(self, action):
"""
Called on self.action(<choice>) and sets self.state
to a new value.
"""
pass
def goal_test(self):
"""
Checks self.state for the goal state.
Returns a boolean.
"""
raise Exception('self.goal_test has not been defined')
def set_cost_func(self, func):
"""
Sets the cost function.
"""
self.cost_func = func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment