28 lines
		
	
	
		
			576 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			576 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from uturtle import (
 | |
|     umonsTurtle, wait,
 | |
|     moveForward, moveBackward,
 | |
|     turnLeft, turnRight,
 | |
|     dropPen, usePen)
 | |
| 
 | |
| from ex3 import koch
 | |
| 
 | |
| 
 | |
| def flocon(t, x, seuil, sides=3):
 | |
|     """draw a star with koch """
 | |
|     flocon_rec(t, x, seuil, sides, sides)
 | |
| 
 | |
| 
 | |
| def flocon_rec(t, x, seuil, sides, i):
 | |
|     """recursion function of flocon()"""
 | |
|     if i > 0:
 | |
|         koch(t, x, seuil)
 | |
|         turnRight(t, 360/sides)
 | |
|         flocon_rec(t, x, seuil, sides, i-1)
 | |
| 
 | |
| 
 | |
| if __name__ == "__main__":
 | |
|     turtle = umonsTurtle()
 | |
|     turtle.speed(0)
 | |
|     flocon(turtle, 100, 6, sides=4)
 | |
|     wait()
 |