Skip to content

Commit 3b074c7

Browse files
unknownunknown
unknown
authored and
unknown
committed
1
1 parent 13c71e5 commit 3b074c7

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.project

+6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
<projects>
66
</projects>
77
<buildSpec>
8+
<buildCommand>
9+
<name>org.python.pydev.PyDevBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
813
</buildSpec>
914
<natures>
15+
<nature>org.python.pydev.pythonNature</nature>
1016
</natures>
1117
</projectDescription>

assignment2/a2.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Rat:
3737
""" A rat caught in a maze. """
3838

3939
# Write your Rat methods here.
40-
def __init__(Rat, symbol, row, col):
40+
def __init__(self, symbol, row, col):
4141
"""(Rat, str, int, int) -> NoneType
4242
>>> Player1 = Rat('P', 1, 4)
4343
>>> Player2 = Rat('J', 2, 3)
@@ -49,17 +49,22 @@ def __init__(Rat, symbol, row, col):
4949
self.col = col
5050
self.num_sprouts_eaten = num_sprouts_eaten
5151

52-
def set_location(Rat,row,col):
52+
def set_location(self, row, col):
5353
"""(Rat, int, int) -> NoneType
5454
5555
"""
5656

5757
row = 0
5858
col = 0
59+
60+
for rows in self.row:
61+
row = self.row + row
62+
63+
for cols in self.col:
64+
col = self.col + col
5965

60-
6166

62-
def eat_sprout(self,Rat):
67+
def eat_sprout(self):
6368
"""(Rat) -> NoneType
6469
"""
6570

@@ -78,12 +83,6 @@ def __str__(self):
7883

7984

8085

81-
82-
83-
84-
85-
86-
8786
class Maze:
8887
""" A 2D maze. """
8988

0 commit comments

Comments
 (0)