-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (26 loc) · 925 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
from game_manager import GameManager
import sys
def __main__():
arg = sys.argv
search_type = "a_star"
if len(arg) > 1:
if arg[1] in ["ids", "a_star", "bd_bfs", "reverse_bfs", "bfs"]:
search_type = arg[1]
else:
print('\n\nUse "ids" or "a_star" or "bd_bfs" as argument.')
return
game_manager = GameManager()
# Finding way
result, depth, cost = game_manager.start_search(search_type)
# Printing outputs
directions = {(1, 0): "D", (-1, 0): "U", (0, 1): "R", (0, -1): "L"}
p1 = game_manager.init_state.person
for i in range(len(result)):
p2 = result[i].person
# print(directions[(p2[0]-p1[0], p2[1]-p1[1])], end='')
print(p2, p1, (p2[0] - p1[0], p2[1] - p1[1]))
p1 = result[i].person
print("\nTotal moves:", depth)
print("Total cost:", cost)
game_manager.display_states(result)
__main__()