def test_ReflexVacuumAgent():
    # create an object of the ReflexVacuumAgent
    agent = ReflexVacuumAgent()
    # create an object of TrivialVacuumEnvironment
    environment = TrivialVacuumEnvironment()
    # add agent to the environment
    environment.add_thing(agent)
    # run the environment
    environment.run()
    # check final status of the environment
    assert environment.status == {(1, 0): 'Clean', (0, 0): 'Clean'}
Exemple #2
0
def Model(start, a, b):
    print("---Start: {}, (0,0):{} (1,0):{}---".format(start, a, b))
    agent = ReflexVacuumAgent()
    env = TrivialVacuumEnvironment()
    env.add_thing(agent, start)
    env.status = {(1, 0): b, (0, 0): a}

    while (env.status != {(1, 0): 'Clean', (0, 0): 'Clean'}):
        env.step()

    return env.agents[0].performance