-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
38 lines (33 loc) · 973 Bytes
/
main.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
from puzzlelogics import *
parent = copy.deepcopy(eightStartState)
print('start')
solvable = True
if checkSolvable() is not True:
print('Impossible to Solve')
solvable = False
prettyPrint([parent])
count = 0
found = False
print('parent added to closed')
addInClosed(parent)
print('....working')
while not found:
children = getNextPossibleStates(parent)
for child in children:
addInFringe(child)
if targetState == child[0]:
print('**************')
print('__Found__')
print('**************')
found = True
getShortestPath(child)
break
current = getLeastState() # from fringe
removeFromFringe(current)
addInClosed(current)
parent = current
print('===========Program Ends===================')
# print('moves', closed)
print('Closed items =', len(closed))
print('Fringe items =', len(fringe))
# prettyPrint([closed])