From 7490cc8e061458661e79bcc5bbf171dc3e89b8c5 Mon Sep 17 00:00:00 2001 From: Pavel Date: Sun, 4 Jun 2023 19:09:59 +0200 Subject: [PATCH] changies in main file for using power of config --- main.py | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/main.py b/main.py index 00dee9b..bffb4d0 100644 --- a/main.py +++ b/main.py @@ -13,6 +13,7 @@ from domain.entities.earring import Earring from domain.entities.docking_station import Doc_Station from domain.world import World from view.renderer import Renderer +from AI_brain.image_recognition import VacuumRecognizer # from AI_brain.movement import GoAnyDirectionBFS, State # from AI_brain.rotate_and_go_bfs import RotateAndGoBFS, State @@ -144,24 +145,28 @@ class Main: def generate_world(tiles_x: int, tiles_y: int) -> World: - world = World(tiles_x, tiles_y) - for _ in range(config.getint("CONSTANT", "NumberOfBananas")): - temp_x = randint(0, tiles_x - 1) - temp_y = randint(0, tiles_y - 1) - world.add_entity(Garbage(temp_x, temp_y)) - world.vacuum = Vacuum(1, 1) - world.doc_station = Doc_Station(9, 8) - if config.getboolean("APP", "cat"): - world.cat = Cat(7, 8) - world.add_entity(world.cat) - world.add_entity(Entity(2, 8, "PLANT1")) - world.add_entity(Entity(4, 1, "PLANT1")) - world.add_entity(Entity(3, 4, "PLANT2")) - world.add_entity(Entity(8, 8, "PLANT2")) - world.add_entity(Entity(9, 3, "PLANT3")) - world.add_entity(Earring(9, 7)) - world.add_entity(Earring(5, 5)) - world.add_entity(Earring(4, 6)) + if config.getboolean("NEURAL_NETWORK", "is_nural_network_off"): + world = World(tiles_x, tiles_y) + for _ in range(config.getint("CONSTANT", "NumberOfBananas")): + temp_x = randint(0, tiles_x - 1) + temp_y = randint(0, tiles_y - 1) + world.add_entity(Garbage(temp_x, temp_y)) + world.vacuum = Vacuum(1, 1) + world.doc_station = Doc_Station(9, 8) + if config.getboolean("APP", "cat"): + world.cat = Cat(7, 8) + world.add_entity(world.cat) + world.add_entity(Entity(2, 8, "PLANT1")) + world.add_entity(Entity(4, 1, "PLANT1")) + world.add_entity(Entity(3, 4, "PLANT2")) + world.add_entity(Entity(8, 8, "PLANT2")) + world.add_entity(Entity(9, 3, "PLANT3")) + world.add_entity(Earring(9, 7)) + world.add_entity(Earring(5, 5)) + world.add_entity(Earring(4, 6)) + else: + pass + for x in range(world.width): for y in range(world.height):