-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpos.py
50 lines (38 loc) · 1.14 KB
/
pos.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class Position():
def __init__(self):
self.coordinate = Coordinate(-1, -1)
self.entity = None
self.wall = False
def setPosition(self, coordinate, entity, wall):
self.coordinate = coordinate
self.entity = entity
self.wall = wall
def setCoordinate(self, coordinate):
self.coordinate = coordinate
def setWall(self, isWall):
self.wall = isWall
def print(self):
print(self.coordinate, self.entity)
def __str__(self):
s = "Entity: " + str(self.entity) + " at coordinate" + str(self.coordinate)
return s
class Coordinate():
def __init__(self, row, column):
self.row = row
self.column = column
def setCoordinate(self, row, column):
self.row = row
self.column = column
def isInit(self):
if self.row == -1:
return True
else:
return False
def __str__(self):
t = (self.row, self.column)
return str(t)
def __eq__(self, c1):
if self.row == c1.row and self.column == c1.column:
return True
else:
return False