Commit 96da0e85 authored by Ahmad Reza's avatar Ahmad Reza
Browse files

Bug-Fix with delete_matter_in

Create_scenario changed to only scenario
parent 8b897d47
......@@ -1225,7 +1225,7 @@ class Particle(matter.matter):
logging.info("Could not delet tile with tile id %s", str(id))
return False
def delete_tile_in(self, dir=E):
def delete_tile_in(self, dir=None):
"""
Deletes a tile either in a given direction
......@@ -1234,7 +1234,7 @@ class Particle(matter.matter):
:return: True: Deleting successful; False: Deleting unsuccessful
"""
coords = ()
if -1<dir<7:
if dir is not None:
coords = self.sim.get_coords_in_dir(self.coords, dir)
logging.info("Deleting tile in %s direction", str(dir))
if coords is not None:
......@@ -1565,7 +1565,7 @@ class Particle(matter.matter):
:param dir: The direction on which the particle should be deleted. Options: E, SE, SW, W, NW, NE,
:return: True: Deleting successful; False: Deleting unsuccessful
"""
if dir:
if dir is not None:
coords = self.sim.get_coords_in_dir(self.coords, dir)
logging.info("Deleting tile in %s direction", str(dir))
if self.sim.remove_particle_on(coords):
......@@ -1900,7 +1900,7 @@ class Particle(matter.matter):
else:
logging.info("Could not delet location with location id %s", str(location_id))
def delete_location_in(self, dir=None, x=None, y=None):
def delete_location_in(self, dir=None):
"""
Deletes a location either in a given direction or on a given x,y coordinates
......@@ -1910,11 +1910,9 @@ class Particle(matter.matter):
:return: True: Deleting successful; False: Deleting unsuccessful
"""
if dir:
if dir is not None:
coords = self.sim.get_coords_in_dir(self.coords, dir)
logging.info("Deleting tile in %s direction", str(dir))
elif x is not None and y is not None:
coords = (x, y)
if self.sim.remove_location_on(coords):
logging.info("Deleted location with location on coords %s", str(coords))
self.csv_particle_writer.write_particle(location_deleted=1)
......
......@@ -103,7 +103,7 @@ class Sim:
steps=0, directory=dir)
mod = importlib.import_module('scenario.' + scenario_name.rsplit('.',1)[0])
mod.create_scenario(self)
mod.scenario(self)
if random_order:
random.shuffle(self.particles)
......
Supports Markdown
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