labs/Lab_W1_Solution.py
def TableDrivenFarmerAgentProgram(table):
    """This agent selects an action based on the percept sequence.
    It is practical only for tiny domains.
    To customize it, provide as table a dictionary of all
    {percept_sequence:action} pairs. [Figure 2.7]"""
    percepts = []

    def program(percept):
        print("TableDrivenFarmerAgentProgram [Percept]: ", percept)   
        percepts.append(percept)
        action = table.get(tuple(percepts))
        print("TableDrivenFarmerAgentProgram [Action]: ", action)       
        return action

    return program
This agent selects an action based on the percept sequence.
    It is practical only for tiny domains.
    To customize it, provide as table a dictionary of all
    {percept_sequence:action} pairs. [Figure 2.7]
This agent selects an action based on the percept sequence.
It is practical only for tiny domains.
To customize it, provide as table a dictionary of all
{percept_sequence:action} pairs.
This agent selects an action based on the percept sequence . It is practical only for tiny domains . To customize it provide as table a dictionary of all { percept_sequence : action } pairs .
def TableDrivenFarmerAgentProgram(table):
    percepts = []
    def program(percept):
        print("TableDrivenFarmerAgentProgram [Percept]: ", percept)   
        percepts.append(percept)
        action = table.get(tuple(percepts))
        print("TableDrivenFarmerAgentProgram [Action]: ", action)       
        return action
    return program
def TableDrivenFarmerAgentProgram ( table ) : percepts = [ ] def program ( percept ) : print ( "TableDrivenFarmerAgentProgram [Percept]: " , percept ) percepts . append ( percept ) action = table . get ( tuple ( percepts ) ) print ( "TableDrivenFarmerAgentProgram [Action]: " , action ) return action return program
This agent selects an action based on the percept sequence.
This agent selects an action based on the percept sequence .
"""This agent selects an action based on the percept sequence.
    It is practical only for tiny domains.
    To customize it, provide as table a dictionary of all
    {percept_sequence:action} pairs. [Figure 2.7]"""
table