SZI2019SmieciarzWmi/config.py

27 lines
717 B
Python
Raw Normal View History

import sys
import getopt
from sprites.cell import CELL_SIZE
def set_home_amount():
arguments = sys.argv[1:]
try:
optlist, args = getopt.getopt(arguments, '', ['home-count='])
for o, amount in optlist:
if o == '--home-count':
if int(amount) < 2:
print('Home count too low - must be higher than 2')
sys.exit(2)
return int(amount)
print('Missing argument: --home-count <amount>')
sys.exit(2)
except getopt.GetoptError as err:
print(err)
sys.exit(2)
home_amount = set_home_amount()
2019-03-25 13:44:16 +01:00
PLAY_WIDTH = (home_amount+2)*CELL_SIZE
PLAY_HEIGHT = PLAY_WIDTH