code: 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)f 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))
docs: [Fig. 2.3]