|
|
@@ -356,10 +356,10 @@ def draw_karel(
|
|
|
if background == "random":
|
|
|
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.
|
|
|
Orientations are in relation to the centre of Karel.
|
|
|
- '''
|
|
|
+ """
|
|
|
match orientation.lower():
|
|
|
case "east" | "south-flipped":
|
|
|
left_operand = operator.sub # Left / Top
|
|
|
@@ -647,9 +647,7 @@ def draw_karel(
|
|
|
logger.debug(f"Created Karel: {shapes, arguments}")
|
|
|
return [shapes, arguments, "karel"]
|
|
|
|
|
|
-"""
|
|
|
-Beeper functions
|
|
|
-
|
|
|
+""" Beeper functions
|
|
|
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,
|
|
|
perhaps in coordinated group movements with Karels.
|
|
|
@@ -719,50 +717,17 @@ def draw_beeper(
|
|
|
bottom_corner = centre_x, bottom
|
|
|
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],
|
|
|
- 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],
|
|
|
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,
|
|
|
outline = colour
|
|
|
)
|
|
|
|
|
|
# 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 = {
|
|
|
"filler": filler
|
|
|
}
|