config added constant

This commit is contained in:
Mateusz Dokowicz 2023-05-25 16:59:50 +02:00
parent 44bdfa8ae1
commit d470601fe1
2 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,7 @@
[APP] [APP]
cat = False cat = False
movement = robot movement = robot
NumberOfBananas = 20 #accept: human, robot
#accept: human, robot
[CONSTANT]
NumberOfBananas = 20

View File

@ -145,7 +145,7 @@ class Main:
def generate_world(tiles_x: int, tiles_y: int) -> World: def generate_world(tiles_x: int, tiles_y: int) -> World:
world = World(tiles_x, tiles_y) world = World(tiles_x, tiles_y)
for _ in range(config.getint("APP", "NumberOfBananas")): for _ in range(config.getint("CONSTANT", "NumberOfBananas")):
temp_x = randint(0, tiles_x - 1) temp_x = randint(0, tiles_x - 1)
temp_y = randint(0, tiles_y - 1) temp_y = randint(0, tiles_y - 1)
world.add_entity(Garbage(temp_x, temp_y)) world.add_entity(Garbage(temp_x, temp_y))