You are to edit the file hw1.py, as described in the instructions. We have provided a solution file, hw1a.pyc, which is compiled bytecode that you may run.
Below we demonstrate the code, both with and without graphics.
from hw1a import *
gv = GraphicVacuumEnvironment(10,10,bias=0.5,color={'Agent': (200,0,0), 'Dirt': (230, 115, 40), 'Wall': (100,100,100)})
rv = TraceAgent(BetterReflexVacuumAgent())
gv.add_thing(rv)
gv.get_world()
rv.performance
rv.location
gv.run(10)
rv.location
rv.performance
Now we create a vacuum world without graphics.
nve = NewVacuumEnvironment(10,10,bias=0.5)
nrv = TraceAgent(BetterReflexVacuumAgent())
nve.add_thing(nrv)
nve.get_world()
nve.run(10)
nrv.location
nrv.performance
main()
Below we demonstrate the testing code from the end of agents.py
environment = TrivialVacuumEnvironment
agents = [ModelBasedVacuumAgent, ReflexVacuumAgent]
result = compare_agents(environment, agents)
result