-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.py
43 lines (32 loc) · 881 Bytes
/
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
#Author: Nicholas Massad
#Date: 28/02/2023
class Node:
def __init__(self, parent=None, position=None):
self.parent = parent
self.child = None
self.pos = position
self.samples = []
self.inspected = False
self.g = 0
self.h = 0
self.f = 0
self.cost = 0
def __eq__(self, other):
return self.pos == other.pos
def __hash__(self):
return hash(self.pos)
def __lt__(self, other):
return self.f < other.f
def get_pos(self):
return self.pos
def save(self, samples):
self.samples = samples
self.inspected = True
def set_parent(self, parent):
self.parent = parent
def set_child(self, child):
self.child = child
def get_parent(self):
return self.parent
def get_child(self):
return self.child