-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode1.py
44 lines (27 loc) · 838 Bytes
/
Node1.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
from State import State
import copy
import math
import hashlib
from collections import defaultdict
class Node:
def __init__(self, _state, _depth):
#state the node represents
self.state = _state
#name of state
self.name = _state.get_string_board()
#list of possible moves
self.moves = self.state.find_next_steps()
#move performed to reach current node
self.previous_move = None
#next move to visit
self.move_index=0
# branch factor
self.BF = len(self.moves)
#depth : how many moves to get this state
self.depth = _depth
#Estimation of distance from goal state
self.F = 0
#pointer to parent node
self.parent = None
def __lt__(self, other):
return self.F < other.F