-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
28 lines (24 loc) · 856 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
from uniformed_search_algo import *
def run_NPuzzle_program():
mode = 'w'
file_input = get_input_from_file('input.txt')
for line in file_input:
ls = line.rstrip().split(',')
state = ''
for i in ls:
state = state + str(i) + ','
state = state.rstrip(',')
print(state)
bfs_path = "BFS: " + bfs_search(line)
print(bfs_path)
ucs_path = "UCS: " + UCS_search(line)
print(ucs_path)
ids_path = "IDS: " + IDS_search(line)
print(ids_path)
dfs_path = "DFS: " + dfs_search(line)
print(dfs_path)
write_output_to_file('output.txt', bfs_path + '\n' + ucs_path + '\n' + ids_path + '\n' + dfs_path +
'\n', mode)
mode = 'a'
# Main function Calling
run_NPuzzle_program()