Commit 4c7aec6a authored by Ahmad Reza's avatar Ahmad Reza
Browse files

the method check_coords is renamed to check_values_are_coordinates

parent b1014a79
......@@ -91,7 +91,7 @@ class Particle(matter.Matter):
"""
direction_coord = get_coords_in_direction(self.coords, direction)
direction, direction_coord = self.check_within_border(direction, direction_coord)
if check_coords(direction_coord[0], direction_coord[1]):
if check_values_are_coordinates(direction_coord[0], direction_coord[1]):
if self.coords in self.world.particle_map_coords:
del self.world.particle_map_coords[self.coords]
......@@ -520,7 +520,7 @@ class Particle(matter.Matter):
logging.info("particle with id %s is", self.get_id())
if x is not None and y is not None:
coords = (x, y)
if check_coords(x,y):
if check_values_are_coordinates(x,y):
logging.info("Going to create a tile on position \(%i , %i\)", x,y )
if self.world.add_tile(coords[0], coords[1], color, alpha) == True:
self.world.tile_map_coords[coords[0], coords[1]].created = True
......@@ -701,7 +701,7 @@ class Particle(matter.Matter):
:return: True: successful taken; False: unsuccessful taken
"""
if self.carried_particle is None and self.carried_tile is None:
if check_coords(x, y):
if check_values_are_coordinates(x, y):
coords = (x, y)
if coords in self.world.tile_map_coords:
self.carried_tile = self.world.tile_map_coords[coords]
......@@ -781,7 +781,7 @@ class Particle(matter.Matter):
:param y: y coordinate
"""
if self.carried_tile is not None:
if check_coords(x, y):
if check_values_are_coordinates(x, y):
coords = (x, y)
if coords not in self.world.get_tile_map_coords():
try: # cher: insert so to overcome the AttributeError
......@@ -859,7 +859,7 @@ class Particle(matter.Matter):
"""
coords = (0, 0)
if x is not None and y is not None:
if check_coords(x, y):
if check_values_are_coordinates(x, y):
coords = (x, y)
logging.info("Going to create a particle on position %s", str(coords))
new_particle = self.world.add_particle(coords[0], coords[1], color, alpha)
......@@ -934,7 +934,7 @@ class Particle(matter.Matter):
:return: True: Deleting successful; False: Deleting unsuccessful
"""
if x is not None and y is not None:
if check_coords(x, y):
if check_values_are_coordinates(x, y):
coords = (x, y)
if self.world.remove_particle_on(coords):
logging.info("Deleted particle with particle on coords %s", str(coords))
......@@ -1035,7 +1035,7 @@ class Particle(matter.Matter):
:return: True: Successful taken; False: Cannot be taken or wrong Coordinates
"""
if self.carried_particle is None and self.carried_tile is None:
if check_coords(x, y):
if check_values_are_coordinates(x, y):
coords = (x, y)
if coords in self.world.particle_map_coords:
self.carried_particle = self.world.particle_map_coords[coords]
......@@ -1113,7 +1113,7 @@ class Particle(matter.Matter):
:param x: x coordinate
:param y: y coordinate
"""
if self.carried_particle is not None and x is not None and y is not None and check_coords(x, y):
if self.carried_particle is not None and x is not None and y is not None and check_values_are_coordinates(x, y):
coords = (x, y)
if coords not in self.world.particle_map_coords:
try: # cher: insert so to overcome the AttributeError
......@@ -1196,7 +1196,7 @@ class Particle(matter.Matter):
"""
coords = (0, 0)
if x is not None and y is not None:
if check_coords(x, y):
if check_values_are_coordinates(x, y):
coords = (x, y)
logging.info("Going to create a marker on position %s", str(coords))
new_marker = self.world.add_marker(coords[0], coords[1], color, alpha)
......@@ -1271,7 +1271,7 @@ class Particle(matter.Matter):
:return: True: Deleting successful; False: Deleting unsuccessful
"""
if x is not None and y is not None:
if check_coords(x, y):
if check_values_are_coordinates(x, y):
coords = (x, y)
if self.world.remove_marker_on(coords):
logging.info("Deleted marker oords %s", str(coords))
......
......@@ -85,7 +85,7 @@ def direction_in_range(direction):
return direction % 6
def check_coords(coords_x, coords_y):
def check_values_are_coordinates(coords_x, coords_y):
"""
Checks if the given coordinates are matching the
hexagon coordinates
......
......@@ -273,7 +273,7 @@ class World:
if alpha < 0 or alpha >1:
alpha = 1
if len(self.particles) < self.config_data.max_particles:
if check_coords(x,y) == True:
if check_values_are_coordinates(x,y) == True:
if (x,y) not in self.get_particle_map_coords():
self.particle_id_counter += 1
new_particle = particle.Particle(self, x, y, color, alpha, self.particle_id_counter)
......@@ -357,7 +357,7 @@ class World:
"""
if alpha < 0 or alpha >1:
alpha = 1
if check_coords(x,y) == True:
if check_values_are_coordinates(x,y) == True:
if (x,y) not in self.tile_map_coords:
self.new_tile=tile.Tile(self, x, y, color, alpha)
print("Before adding ", len(self.tiles) )
......@@ -386,7 +386,7 @@ class World:
:param y: the y coordinates on which the tile should be added
:return: True: Successful added; False: Unsuccsessful
"""
if check_coords(x, y) == True:
if check_values_are_coordinates(x, y) == True:
if (x, y) not in self.tile_map_coords:
self.new_tile = tile.Tile(self, x, y, color, alpha)
self.tiles.append(self.new_tile)
......@@ -466,7 +466,7 @@ class World:
"""
if alpha < 0 or alpha >1:
alpha = 1
if check_coords(x, y) == True:
if check_values_are_coordinates(x, y) == True:
if (x, y) not in self.marker_map_coords:
self.new_marker = marker.Marker(self, x, y, color, alpha)
self.markers.append(self.new_marker)
......
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