def __init__(self, env, print_iterations=False): ''' Class constructor Args: env: Environment representing the sudoku print_iterations: Flag that tells the agent whether to print the sudoku ''' Agent.__init__(self, env) self.original_sudoku = copy.deepcopy(env.sudoku) self.percepts = env.initial_percepts() self.sudoku = self.percepts['sudoku'] self.csp = self.percepts['csp'] self.print_iterations = print_iterations
def __init__(self, env, bound=100): """Connects to the next available port. Args: env: A reference to an environment. """ # Make a connection to the environment using the superclass constructor Agent.__init__(self, env) # Get initial percepts self.percepts = env.initial_percepts() # Initializes the frontier with the initial postion self.frontier = [[self.percepts['current_position']]] # Initializes list of visited nodes for multiple path prunning self.visited = []