aima/agents.py
def TableDrivenVacuumAgent():
    "[Fig. 2.3]"
    table = {((loc_A, 'Clean'),): 'Right',
             ((loc_A, 'Dirty'),): 'Suck',
             ((loc_B, 'Clean'),): 'Left',
             ((loc_B, 'Dirty'),): 'Suck',
             ((loc_A, 'Clean'), (loc_A, 'Clean')): 'Right',
             ((loc_A, 'Clean'), (loc_A, 'Dirty')): 'Suck',
             # ...
             ((loc_A, 'Clean'), (loc_A, 'Clean'), (loc_A, 'Clean')): 'Right',
             ((loc_A, 'Clean'), (loc_A, 'Clean'), (loc_A, 'Dirty')): 'Suck',
             # ...
             }
    return Agent(TableDrivenAgentProgram(table))
def TableDrivenVacuumAgent():
    "[Fig. 2.3]"
    table = {((loc_A, 'Clean'),): 'Right',
             ((loc_A, 'Dirty'),): 'Suck',
             ((loc_B, 'Clean'),): 'Left',
             ((loc_B, 'Dirty'),): 'Suck',
             ((loc_A, 'Clean'), (loc_A, 'Clean')): 'Right',
             ((loc_A, 'Clean'), (loc_A, 'Dirty')): 'Suck',
             # ...
             ((loc_A, 'Clean'), (loc_A, 'Clean'), (loc_A, 'Clean')): 'Right',
             ((loc_A, 'Clean'), (loc_A, 'Clean'), (loc_A, 'Dirty')): 'Suck',
             # ...
             }
    return Agent(TableDrivenAgentProgram(table))
def TableDrivenVacuumAgent ( ) : table = { ( ( loc_A , 'Clean' ) , ) : 'Right' , ( ( loc_A , 'Dirty' ) , ) : 'Suck' , ( ( loc_B , 'Clean' ) , ) : 'Left' , ( ( loc_B , 'Dirty' ) , ) : 'Suck' , ( ( loc_A , 'Clean' ) , ( loc_A , 'Clean' ) ) : 'Right' , ( ( loc_A , 'Clean' ) , ( loc_A , 'Dirty' ) ) : 'Suck' , # ... ( ( loc_A , 'Clean' ) , ( loc_A , 'Clean' ) , ( loc_A , 'Clean' ) ) : 'Right' , ( ( loc_A , 'Clean' ) , ( loc_A , 'Clean' ) , ( loc_A , 'Dirty' ) ) : 'Suck' , # ... } return Agent ( TableDrivenAgentProgram ( table ) )
[Fig. 2.3]
[ Fig . 2 . 3 ]