tBKwtWS 1 сар өмнө
parent
commit
12f22ee8ed
1 өөрчлөгдсөн 4 нэмэгдсэн , 4 устгасан
  1. 4 4
      karel_asset.py

+ 4 - 4
karel_asset.py

@@ -281,17 +281,17 @@ def generate_outofbounds_random_karel(canvas, side):
     # Generate random coordinates (Outside the canvas geometry)
     match side:
         case "left":
-            centre_x = int(0 - size / 2)
+            centre_x = int(0 - size / 2 - 1)
             centre_y = random.randint(int(size / 2), int(canvas.height - size / 2))
         case "top":
             centre_x = random.randint(int(size / 2), int(canvas.height - size / 2))
-            centre_y = int(0 - size / 2)
+            centre_y = int(0 - size / 2 - 1)
         case "right":
-            centre_x = int(0 + size / 2)
+            centre_x = int(0 + size / 2 + 1)
             centre_y = random.randint(int(size / 2), int(canvas.height - size / 2))
         case "bottom":
             centre_x = random.randint(int(size / 2), int(canvas.height - size / 2))
-            centre_y = int(0 + size / 2)
+            centre_y = int(0 + size / 2 + 1)
     
     # Generate random values
     orientation = random.choice(["east", "east-flipped", "north", "north-flipped", "west", "west-flipped", "south", "south-flipped"])