-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.py
49 lines (37 loc) · 1.01 KB
/
Node.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
'''
Node class
specialValue: math.inf if that node is a trap
start: the start Node
exit: the exit Node
'''
class Node:
fee = 0
specialValue = 0
gValue = 0
fValue = 0;
def __init__(self, x, y):
self.x = x
self.y = y
def GenerateChildren(self):
tempX = self.x
tempY = self.y
retList = []
tempX += 1
if tempX <= 19:
tempNode = Node(tempX, self.y)
retList.append(tempNode)
tempX -= 2
if tempX >= 0:
tempNode = Node(tempX, self.y)
retList.append(tempNode)
tempY += 1
if tempY <= 19:
tempNode = Node(self.x, tempY)
retList.append(tempNode)
tempY -= 2
if tempY >= 0:
tempNode = Node(self.x, tempY)
retList.append(tempNode)
return retList
def PrettyStringNode(self):
return '(' + str(self.x) + ',' + str(self.y) + ')'