Commit 4331d928 authored by Ahmad Reza Cheraghi's avatar Ahmad Reza Cheraghi
Browse files

Merge branch 'master' into 'visualisierung'

# Conflicts:
#   config.ini
#   robotsOnTiles/csv_generator.py
#   robotsOnTiles/particle.py
#   robotsOnTiles/scenarios/search_for_tile_rw.py
#   robotsOnTiles/worlds/tile_beside_particle.py
parents a46b0127 0329772d
......@@ -22,7 +22,7 @@ max_particles=100
world = world_test_interfaces.py
#scenario = read_write.py
#scenario = scanning.py
#scenario = scanning.py
#scenario = create_delete.py
#scenario = scanning_for_all_aims.py
#scenario = take_drop_aims.py
......
......@@ -309,9 +309,8 @@ class CsvRoundData:
file_name = self.directory+"/aggregate_rounds.csv"
csv_file = open(file_name, 'w', newline='')
writer_round = csv.writer(csv_file)
"""Average Min Max for all other metrics"""
writer_round.writerow(['Seed', 'Rounds Total',
'Solution',
'Scenario',
'Location Counter',
'Location Created Sum', 'Location Created Avg',
'Location Created Min', 'Location Created Max',
......@@ -346,7 +345,7 @@ class CsvRoundData:
csv_interator = [self.seed, data['Round Number'].count(),
self.solution, self.task,
self.solution,
self.locations_num,
data['Location Created'].sum(), data['Location Created'].mean(),
......
......@@ -466,19 +466,7 @@ class Particle:
"""
Deletes a tile on current position
:return: True: Deleting successful; False: Deleting unsuccessful
"""
logging.info("Particle %s is", self.id)
logging.info("is going to delete a tile on current position")
if self.coords in self.world.get_tile_map_coords():
if self.world.remove_tile_on(self.coords):
self.csv_particle_writer.write_particle(tile_deleted=1)
return True
else:
logging.info("Could not delet tile")
return False
def delete_tile_with(self, id):
def delete_tile(self, id):
"""
Deletes a tile with a given tile-id
......@@ -860,29 +848,6 @@ class Particle:
else:
return False
def take_particle(self):
"""
Takes a particle on the actual position
:return: True: successful taken; False: unsuccessful taken
"""
if self.carried_particle is None and self.carried_tile is None:
if self.coords in self.world.particle_map:
self.carried_particle = self.world.particle_map[self.coords]
if self.carried_particle.take_me(coords=self.coords):
logging.info("particle has been taken")
self.world.csv_round_writer.update_metrics(self.world.sim.get_actual_round(), particles_taken=1)
self.csv_particle_writer.write_particle(particles_taken=1)
return True
else:
logging.info("particle could not be taken")
return False
else:
logging.info("No particle on the actual position not in the world")
return False
else:
logging.info("particle cannot taken because particle is carrieng either a particle or a particle")
return False
def take_particle_with(self, id):
"""
......
......@@ -14,6 +14,7 @@ direction = [E, SE, SW, W, NW, NE]
def scenario(sim, world):
for particle in world.get_particle_list():
particle.move_to(random.choice(direction))
#particle.move_to(W)
if particle.coords in world.get_tile_map_coords():
print("Found Tile")
world.csv_round_writer.success(sim.get_actual_round())
\ No newline at end of file
def create_world(world):
world.add_particle(0, 0)
world.add_tile(1, 0)
world.add_particle(-1, 0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment