@@ -11,7 +11,7 @@ def draw_gosper_curve(
1111 side_length : float , depth : int , direction : int = - 1 , angle : float = 60.0
1212) -> None :
1313 """
14- Recursively draws a Gosper curve fractal.
14+ Recursively draws a Gosper curve fractal using turtle graphics .
1515
1616 Args:
1717 side_length: The length of the current segment.
@@ -21,11 +21,7 @@ def draw_gosper_curve(
2121
2222 Example:
2323 >>> import turtle
24- >>> # Mocking turtle methods to allow testing without a GUI
25- >>> turtle.forward = lambda x: None
26- >>> turtle.left = lambda x: None
27- >>> turtle.right = lambda x: None
28- >>> draw_gosper_curve(100.0, 2, -1, 60.0)
24+ >>> draw_gosper_curve(200.0, 4, -1, 60.0) # doctest: +SKIP
2925 """
3026 if depth == 0 :
3127 turtle .forward (side_length )
@@ -63,17 +59,16 @@ def draw_gosper_curve(
6359
6460
6561if __name__ == "__main__" :
66- import doctest
67-
68- doctest .testmod ()
69-
62+ # Screen setup
7063 turtle .title ("Gosper Curve" )
7164 turtle .penup ()
7265 turtle .goto (0 , - 200 )
7366 turtle .pendown ()
7467 turtle .speed (0 )
7568 turtle .width (1 )
7669
70+ # Drawing the curve
7771 draw_gosper_curve (side_length = 200.0 , depth = 4 , direction = - 1 , angle = 60.0 )
7872
73+ # Close window on click
7974 turtle .exitonclick ()
0 commit comments