20 lines
612 B
Python
20 lines
612 B
Python
import sys, getopt, random
|
|
|
|
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)
|
|
|
|
def generate_rand_coordinates(PLAY_WIDTH, PLAY_HEIGHT):
|
|
return (random.randint(0, (PLAY_WIDTH//64)-1), random.randint(0, (PLAY_WIDTH//64)-1)) |