-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.py
45 lines (34 loc) · 1.19 KB
/
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
39
40
41
42
43
44
45
# Author: Bishal Sarang
"""
Driver Program to handle command line arguments and create Solution object
"""
from solve import Solution
import argparse
import itertools
arg = argparse.ArgumentParser()
arg.add_argument("-m", "--method", required=False, help="Specify which method to use")
arg.add_argument("-l", "--legend", required=False, help="Specify if you want to display legend on graph")
args = vars(arg.parse_args())
solve_method = args.get("method", "bfs")
legend_flag = args.get("legend", False)
def main():
s = Solution()
if(s.solve(solve_method)):
# Display SOlution on console
s.show_solution()
output_file_name = f"{solve_method}"
# Draw legend if legend_flag is set
if legend_flag:
if legend_flag[0].upper() == 'T' :
output_file_name += "_legend.png"
s.draw_legend()
else:
output_file_name += ".png"
else:
output_file_name += ".png"
# Write State space tree
s.write_image(output_file_name)
else:
raise Exception("No solution found")
if __name__ == "__main__":
main()