Implementation-neuron-model #28

Merged
s473601 merged 8 commits from Implementation-neuron-model into main 2023-06-04 20:19:43 +02:00
Showing only changes of commit 7e3a9cf3d0 - Show all commits

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(4, 6))
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):