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

Skip to content

Commit 69d93e6

Browse files
articuno12norvig
authored andcommitted
Update agents.py (#322)
1 parent 94e63cd commit 69d93e6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

agents.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ class XYEnvironment(Environment):
381381
that are held."""
382382

383383
def __init__(self, width=10, height=10):
384-
super(XYEnvironment, self).__init__()
384+
super().__init__()
385385

386386
self.width = width
387387
self.height = height
@@ -452,7 +452,7 @@ def add_thing(self, thing, location=(1, 1), exclude_duplicate_class_items=False)
452452
if (exclude_duplicate_class_items and
453453
any(isinstance(t, thing.__class__) for t in self.list_things_at(location))):
454454
return
455-
super(XYEnvironment, self).add_thing(thing, location)
455+
super().add_thing(thing, location)
456456

457457
def is_inbounds(self, location):
458458
"""Checks to make sure that the location is inbounds (within walls if we have walls)"""
@@ -471,11 +471,11 @@ def delete_thing(self, thing):
471471
"""Deletes thing, and everything it is holding (if thing is an agent)"""
472472
if isinstance(thing, Agent):
473473
for obj in thing.holding:
474-
super(XYEnvironment, self).delete_thing(obj)
474+
super().delete_thing(obj)
475475
for obs in self.observers:
476476
obs.thing_deleted(obj)
477477

478-
super(XYEnvironment, self).delete_thing(thing)
478+
super().delete_thing(thing)
479479
for obs in self.observers:
480480
obs.thing_deleted(thing)
481481

@@ -525,7 +525,7 @@ class ContinuousWorld(Environment):
525525
"""Model for Continuous World."""
526526

527527
def __init__(self, width=10, height=10):
528-
super(ContinuousWorld, self).__init__()
528+
super().__init__()
529529
self.width = width
530530
self.height = height
531531

@@ -536,8 +536,8 @@ def add_obstacle(self, coordinates):
536536
class PolygonObstacle(Obstacle):
537537

538538
def __init__(self, coordinates):
539-
"""Coordinates is a list of tuples."""
540-
super(PolygonObstacle, self).__init__()
539+
""" Coordinates is a list of tuples."""
540+
super().__init__()
541541
self.coordinates = coordinates
542542

543543
# ______________________________________________________________________________
@@ -556,7 +556,7 @@ class VacuumEnvironment(XYEnvironment):
556556
each turn taken."""
557557

558558
def __init__(self, width=10, height=10):
559-
super(VacuumEnvironment, self).__init__(width, height)
559+
super().__init__(width, height)
560560
self.add_walls()
561561

562562
def thing_classes(self):
@@ -579,7 +579,7 @@ def execute_action(self, agent, action):
579579
agent.performance += 100
580580
self.delete_thing(dirt)
581581
else:
582-
super(VacuumEnvironment, self).execute_action(agent, action)
582+
super().execute_action(agent, action)
583583

584584
if action != 'NoOp':
585585
agent.performance -= 1
@@ -593,7 +593,7 @@ class TrivialVacuumEnvironment(Environment):
593593
Environment."""
594594

595595
def __init__(self):
596-
super(TrivialVacuumEnvironment, self).__init__()
596+
super().__init__()
597597
self.status = {loc_A: random.choice(['Clean', 'Dirty']),
598598
loc_B: random.choice(['Clean', 'Dirty'])}
599599

@@ -677,7 +677,7 @@ class WumpusEnvironment(XYEnvironment):
677677
# Room should be 4x4 grid of rooms. The extra 2 for walls
678678

679679
def __init__(self, agent_program, width=6, height=6):
680-
super(WumpusEnvironment, self).__init__(width, height)
680+
super().__init__(width, height)
681681
self.init_world(agent_program)
682682

683683
def init_world(self, program):

0 commit comments

Comments
 (0)