Question: class State ( object ) : def _ _ init _ _ ( self , preceding _ action ) : Initialize the

class State(object):
def __init__(self, preceding_action):
"""
Initialize the State object.
"""
# each state MUST store the action that created it
# if you want to be able to actually see your solutions
self.action = preceding_action
pass
def __str__(self):
""" A string representation of the State """
return ""
def __eq__(self, other):
""" Allows states to be compared"""
return False
class Problem(object):
"""The Problem class defines aspects of the problem.
One of the important definitions is the transition model for states.
To interact with search classes, the transition model is defined by:
is_goal(s): returns true if the state is a goal state.
actions(s): returns a list of all legal actions in state s
result(s,a): returns a new state, the result of doing action a in state s
"""
def __init__(self, goal):
""" The problem is defined by a target value. We want to measure that many
liters of water.
:param goal: the number of liters of water we want to measure
"""
self.goal = goal
# INSERT WHATEVER ELSE YOU NEED HERE
def create_initial_state(self):
""" returns an initial state
"""
return None
def is_goal(self, a_state:State):
"""Determine whether a_state is a goal state"""
return False
def actions(self, a_state:State):
""" Returns all the actions that are legal in the given state.
"""
return []
def result(self, a_state:State, an_action):
"""Implements the transition function.
Given a state and an action, return the resulting state.
"""
return None

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!