SZI2019SmieciarzWmi/config.py

42 lines
1.3 KiB
Python

import sys, random, MapGenerator
CELL_SIZE = 64
FPS = 60
DELAY = 50
try:
map_mode = sys.argv[1]
if(map_mode == "auto"):
MAP_NAME = MapGenerator.GenerateMap()
else:
MAP_NAME = map_mode
except:
print("ERROR: Invalid map mode\n Please enter \"auto\" for generated map or provide a path to an existing map.")
sys.exit()
if(len(sys.argv)>2):
CLOSE_ON_END = sys.argv[2]
if(CLOSE_ON_END != "true" and CLOSE_ON_END != "false"):
print("ERROR: Invalid close on end statement\n Please enter \"true\" or \"false\" to specify if app has to shut after finding solution.")
sys.exit()
else:
print("ERROR: Invalid close on end statement\n Please enter \"true\" or \"false\" to specify if app has to shut after finding solution.")
sys.exit()
ALGORITHM = None
if(len(sys.argv)>3):
ALGORITHM = sys.argv[3]
if(ALGORITHM != "bfs" and ALGORITHM != "dfs" and ALGORITHM!= "bestfs"):
print("ERROR: Invalid agorithm statement\n Please enter \"bfs\", \"dfs\" or \"bestfs\" to specify algorithm you want to use.")
sys.exit()
map = open( MAP_NAME, 'r' )
GRID_WIDTH, GRID_HEIGHT = [int(x) for x in map.readline().split()]
GC_X, GC_Y = [int(x) for x in map.readline().split()]
WINDOW_HEIGHT = GRID_HEIGHT * CELL_SIZE
WINDOW_WIDTH = GRID_WIDTH * CELL_SIZE
HOUSE_CAPACITY = random.randint(1, 11)