-
Notifications
You must be signed in to change notification settings - Fork 1
/
node.py
122 lines (98 loc) · 2.61 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
class Node:
def __init__(self, color="white", passable=True, fscore=0, gscore=0, hscore=0, x=0, y=0, name=None, parent=None, neighbor=None, border=False):
self._color = color
self._passable = passable
self._fscore = fscore
self._gscore = gscore
self._hscore = hscore
self._x = x
self._y = y
self._name = name
self._parent = parent
self._border = False
if neighbor is None:
self._neighbor = []
else:
self._neighbor = neighbor
def clear_node():
fscore = 0
gscore = 0
hscore = 0
parent = None
################################
@property
def color(self):
return self._color
@color.setter
def color(self, value):
self._color = value
################################
@property
def passable(self):
return self._passable
@passable.setter
def passable(self, value):
self._passable = value
################################
@property
def fscore(self):
return self._fscore
@fscore.setter
def fscore(self, value):
self._fscore = value
################################
@property
def gscore(self):
return self._gscore
@gscore.setter
def gscore(self, value):
self._gscore = value
################################
@property
def hscore(self):
return self._hscore
@hscore.setter
def hscore(self, value):
self._hscore = value
################################
@property
def x(self):
return self._x
@x.setter
def x(self, value):
self._x = value
################################
@property
def y(self):
return self._y
@y.setter
def y(self, value):
self._y = value
################################
@property
def name(self):
return self._name
@name.setter
def name(self, value):
self._name = value
################################
@property
def parent(self):
return self._parent
@parent.setter
def parent(self, value):
self._parent = value
################################
@property
def neighbor(self):
return self._neighbor
@neighbor.setter
def neighbor(self, value):
self._neighbor.append(value)
################################
@property
def border(self):
return self._border
@color.setter
def border(self, value):
self._border = value