Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfb657f

Browse files
committed
Untabified source code.
1 parent 96cd704 commit bfb657f

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

agents.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,20 @@ def object_classes(self):
195195
return [] ## List of classes that can go into environment
196196

197197
def percept(self, agent):
198-
"Return the percept that the agent sees at this point. (Implement this.)"
198+
"Return the percept that the agent sees at this point. (Implement this.)"
199199
abstract
200200

201201
def execute_action(self, agent, action):
202202
"Change the world to reflect this action. (Implement this.)"
203203
abstract
204204

205205
def default_location(self, object):
206-
"Default location to place a new object with unspecified location."
206+
"Default location to place a new object with unspecified location."
207207
return None
208208

209209
def exogenous_change(self):
210-
"If there is spontaneous change in the world, override this."
211-
pass
210+
"If there is spontaneous change in the world, override this."
211+
pass
212212

213213
def is_done(self):
214214
"By default, we're done when we can't find a live agent."
@@ -217,20 +217,20 @@ def is_done(self):
217217
return True
218218

219219
def step(self):
220-
"""Run the environment for one time step. If the
221-
actions and exogenous changes are independent, this method will
222-
do. If there are interactions between them, you'll need to
223-
override this method."""
224-
if not self.is_done():
220+
"""Run the environment for one time step. If the
221+
actions and exogenous changes are independent, this method will
222+
do. If there are interactions between them, you'll need to
223+
override this method."""
224+
if not self.is_done():
225225
actions = [agent.program(self.percept(agent))
226226
for agent in self.agents]
227227
for (agent, action) in zip(self.agents, actions):
228-
self.execute_action(agent, action)
228+
self.execute_action(agent, action)
229229
self.exogenous_change()
230230

231231
def run(self, steps=1000):
232-
"""Run the Environment for given number of time steps."""
233-
for step in range(steps):
232+
"""Run the Environment for given number of time steps."""
233+
for step in range(steps):
234234
if self.is_done(): return
235235
self.step()
236236

@@ -245,11 +245,11 @@ def some_objects_at(self, location, oclass=Object):
245245
return self.list_objects_at(location, oclass) != []
246246

247247
def add_object(self, obj, location=None):
248-
"""Add an object to the environment, setting its location. Also keep
249-
track of objects that are agents. Shouldn't need to override this."""
250-
obj.location = location or self.default_location(obj)
251-
self.objects.append(obj)
252-
if isinstance(obj, Agent):
248+
"""Add an object to the environment, setting its location. Also keep
249+
track of objects that are agents. Shouldn't need to override this."""
250+
obj.location = location or self.default_location(obj)
251+
self.objects.append(obj)
252+
if isinstance(obj, Agent):
253253
obj.performance = 0
254254
self.agents.append(obj)
255255

text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def __init__(self):
219219
import os
220220
mandir = '../data/MAN/'
221221
man_files = [mandir + f for f in os.listdir(mandir)
222-
if f.endswith('.txt')]
222+
if f.endswith('.txt')]
223223
self.index_collection(man_files)
224224

225225
class Document:

utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,10 @@ def random_tests(text):
723723
"""Some functions are stochastic. We want to be able to write a test
724724
with random output. We do that by ignoring the output."""
725725
def fixup(test):
726-
if " = " in test:
727-
return ">>> " + test
728-
else:
729-
return ">>> ignore(" + test + ")"
726+
if " = " in test:
727+
return ">>> " + test
728+
else:
729+
return ">>> ignore(" + test + ")"
730730
tests = re.findall(">>> (.*)", text)
731731
return '\n'.join(map(fixup, tests))
732732

@@ -904,5 +904,3 @@ def fixup(test):
904904
['a', 'b', 'c', 'd', 'r', 'w', 'y', 'z']
905905
906906
"""
907-
908-

0 commit comments

Comments
 (0)