-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathneww.py
More file actions
33 lines (24 loc) · 1.07 KB
/
neww.py
File metadata and controls
33 lines (24 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from agents import *
from notebook import psource
def Generate_Environment():
psource(TrivialVacuumEnvironment)
return TrivialVacuumEnvironment()
def Random_Agent():
# These are the two locations for the two-state environment
loc_A, loc_B = (0, 0), (1, 0)
# Initialize the two-state environment
trivial_vacuum_env = Generate_Environment()
# Check the initial state of the environment
print("State of the Environment: {}.".format(trivial_vacuum_env.status))
# Create the random agent
random_agent = Agent(program=RandomAgentProgram(['Right', 'Left', 'Suck', 'NoOp']))
# Add agent to the environment
trivial_vacuum_env.add_thing(random_agent)
print("RandomVacuumAgent is located at {}.".format(random_agent.location))
# Running the environment
trivial_vacuum_env.run()
# Check the current state of the environment
print("State of the Environment: {}.".format(trivial_vacuum_env.status))
print("RandomVacuumAgent is located at {}.".format(random_agent.location))
Random_Agent()
def