home · contact · privacy
Some more code style improvements after flake8.
[plomrogue2] / plomrogue / mapping.py
index 97f788bf59c52d6b992b25b083f22a5259afc5bd..5822dada4371170542923c1c63e894e95bc3e1df 100644 (file)
@@ -195,7 +195,7 @@ class Map():
         if width_line != width_map:
             raise ArgError('map line width %s unequal map width %s' % (width_line, width_map))
         self.terrain = self.terrain[:y * width_map] + line +\
-                       self.terrain[(y + 1) * width_map:]
+            self.terrain[(y + 1) * width_map:]
 
     def get_position_index(self, yx):
         return yx.y * self.geometry.size.x + yx.x
@@ -212,7 +212,7 @@ class SourcedMap(Map):
     def __init__(self, source_maps, source_center, radius, get_map):
         self.source_maps = source_maps
         self.radius = radius
-        example_map = get_map(YX(0,0))
+        example_map = get_map(YX(0, 0))
         self.source_geometry = example_map.geometry
         size, self.offset, self.center = \
             self.source_geometry.define_segment(source_center, radius)
@@ -262,16 +262,16 @@ class DijkstraMap(SourcedMap):
                     if self.terrain[j] < self.terrain[i] - 1:
                         self.terrain[i] = self.terrain[j] + 1
                         shrunk = True
-        #print('DEBUG Dijkstra')
-        #line_to_print = []
-        #x = 0
-        #for n in self.terrain:
-        #    line_to_print += ['%3s' % n]
-        #    x += 1
-        #    if x >= self.size.x:
-        #        x = 0
-        #        print(' '.join(line_to_print))
-        #        line_to_print = []
+        # print('DEBUG Dijkstra')
+        # line_to_print = []
+        # x = 0
+        # for n in self.terrain:
+        #     line_to_print += ['%3s' % n]
+        #     x += 1
+        #     if x >= self.size.x:
+        #         x = 0
+        #         print(' '.join(line_to_print))
+        #         line_to_print = []
 
 
 
@@ -281,7 +281,7 @@ class FovMap(SourcedMap):
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
-        self.terrain = '?' * self.size_i #self.size.y * self.size.x
+        self.terrain = '?' * self.size_i
         self[self.center] = '.'
         self.shadow_cones = []
         self.circle_out(self.center, self.shadow_process)
@@ -302,7 +302,7 @@ class FovMap(SourcedMap):
         def in_shadow_cone(new_cone):
             for old_cone in self.shadow_cones:
                 if old_cone[0] <= new_cone[0] and \
-                    new_cone[1] <= old_cone[1]:
+                   new_cone[1] <= old_cone[1]:
                     return True
                 # We might want to also shade tiles whose middle arm is inside a
                 # shadow cone for a darker FOV. Note that we then could not for
@@ -336,9 +336,9 @@ class FovMap(SourcedMap):
                 if unmerged:
                     self.shadow_cones += [cone]
 
-        step_size = (CIRCLE/len(self.circle_out_directions)) / distance_to_center
+        step_size = (CIRCLE / len(self.circle_out_directions)) / distance_to_center
         number_steps = dir_i * distance_to_center + dir_progress
-        left_arm = correct_arm(step_size/2 + step_size*number_steps)
+        left_arm = correct_arm(step_size / 2 + step_size * number_steps)
         right_arm = correct_arm(left_arm + step_size)
 
         # Optimization potential: left cone could be derived from previous