Преглед изворни кода

beeper fix, removed commented out remains

tBKwtWS пре 1 месец
родитељ
комит
fc76d16bc9
1 измењених фајлова са 6 додато и 41 уклоњено
  1. 6 41
      karel_asset.py

+ 6 - 41
karel_asset.py

@@ -356,10 +356,10 @@ def draw_karel(
     if background == "random":
     if background == "random":
         background = generate_random_colour()
         background = generate_random_colour()
 
 
-    ''' Flipper case
+    """ Flipper case
     In order to be able to flip Karel, the operands in the forumlas must be able to switch around.
     In order to be able to flip Karel, the operands in the forumlas must be able to switch around.
     Orientations are in relation to the centre of Karel.
     Orientations are in relation to the centre of Karel.
-    '''
+    """
     match orientation.lower():     
     match orientation.lower():     
         case "east" | "south-flipped":
         case "east" | "south-flipped":
             left_operand = operator.sub     # Left / Top
             left_operand = operator.sub     # Left / Top
@@ -647,9 +647,7 @@ def draw_karel(
     logger.debug(f"Created Karel: {shapes, arguments}")
     logger.debug(f"Created Karel: {shapes, arguments}")
     return [shapes, arguments, "karel"]
     return [shapes, arguments, "karel"]
 
 
-"""
-Beeper functions
-
+""" Beeper functions
 Even though the beeper is symmetrical in two directions and rotating wont matter,
 Even though the beeper is symmetrical in two directions and rotating wont matter,
 it may be useful in case of moving in relation to orientation,
 it may be useful in case of moving in relation to orientation,
 perhaps in coordinated group movements with Karels.
 perhaps in coordinated group movements with Karels.
@@ -719,50 +717,17 @@ def draw_beeper(
     bottom_corner = centre_x, bottom
     bottom_corner = centre_x, bottom
     right_corner = right, centre_y
     right_corner = right, centre_y
 
 
-    """
-    # Draw outlines
-    north_west_line = canvas.create_line(
+    # Draw insides
+    filler = canvas.create_polygon(
         top_corner[0], top_corner[1],
         top_corner[0], top_corner[1],
-        left_corner[0], left_corner[1],
-        colour
-    )
-    south_west_line = canvas.create_line(
-        left_corner[0], left_corner[1],
-        bottom_corner[0], bottom_corner[1],
-        colour
-    )
-    south_east_line = canvas.create_line(
         right_corner[0], right_corner[1],
         right_corner[0], right_corner[1],
         bottom_corner[0], bottom_corner[1],
         bottom_corner[0], bottom_corner[1],
-        colour    
-    )
-    north_east_line = canvas.create_line(
-        top_corner[0], top_corner[1],
-        right_corner[0], right_corner[1],
-        colour
-    )
-    """
-
-    # Draw insides
-    filler = canvas.create_polygon(
-        top_corner[0] + 1, top_corner[1] + 1,
-        right_corner[0] - 1, right_corner[1] - 1,
-        bottom_corner[0] - 1, bottom_corner[1] - 1,
-        left_corner[0] + 1, left_corner[1] + 1,
+        left_corner[0], left_corner[1],
         color = background,
         color = background,
         outline = colour
         outline = colour
     )
     )
 
 
     # Return each object so it can later be altered/destroyed
     # Return each object so it can later be altered/destroyed
-    """
-    shapes = {
-        "north_west_line": north_west_line,
-        "south_west_line": south_west_line,
-        "south_east_line": south_east_line,
-        "north_east_line": north_east_line,
-        "filler": filler
-    }
-    """
     shapes = {
     shapes = {
         "filler": filler
         "filler": filler
     }
     }