Last changies for correct work of neuron network

This commit is contained in:
Pavel 2023-06-04 19:11:12 +02:00
parent 7490cc8e06
commit 7e3a9cf3d0

38
main.py
View File

@ -165,7 +165,43 @@ def generate_world(tiles_x: int, tiles_y: int) -> World:
world.add_entity(Earring(5, 5)) world.add_entity(Earring(5, 5))
world.add_entity(Earring(4, 6)) world.add_entity(Earring(4, 6))
else: else:
pass def world_adder(x,y,object,style=None):
print(object)
if object == 'Plant':
world.add_entity(Entity(x, y, f"PLANT{randint(1, 3)}"))
if object == 'Earings':
world.add_entity(Earring(x, y))
if object == 'Banana':
world.add_entity(Garbage(temp_x, temp_y))
if object == 'Cat' and config.getboolean("APP", "cat"):
world.add_entity(Cat(x, y))
neural_network = VacuumRecognizer()
world = World(tiles_x, tiles_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)
for _ in range(config.getint("CONSTANT", "NumberOfPlants")):
temp_x = randint(0, tiles_x - 1)
temp_y = randint(0, tiles_y - 1)
path = VacuumRecognizer.get_random_dir(neural_network,'Plant')
world_adder(temp_x, temp_y, neural_network.recognize(path))
for _ in range(config.getint("CONSTANT", "NumberOfEarrings")):
temp_x = randint(0, tiles_x - 1)
temp_y = randint(0, tiles_y - 1)
path = VacuumRecognizer.get_random_dir(neural_network,'Earings')
world_adder(temp_x, temp_y, neural_network.recognize(path))
for _ in range(config.getint("CONSTANT", "NumberOfBananas")):
temp_x = randint(0, tiles_x - 1)
temp_y = randint(0, tiles_y - 1)
path = VacuumRecognizer.get_random_dir(neural_network,'Banana')
world_adder(temp_x, temp_y, neural_network.recognize(path))
for x in range(world.width): for x in range(world.width):