This commit is contained in:
Debucquoy
2023-09-20 15:18:20 +02:00
parent 00d0cdfaf3
commit 4fd7542f03
228 changed files with 351 additions and 12 deletions

28
bac1/q1/04oct/ex5.py Normal file
View File

@ -0,0 +1,28 @@
from uturtle import (
umonsTurtle, wait,
moveForward, moveBackward,
turnLeft, turnRight,
dropPen, usePen)
def carre(t: umonsTurtle, x: int, seuil: int):
"""draw an alternative to koch witch is based on squares"""
if x < seuil:
moveForward(t, x)
return
carre(t, x/3, seuil)
turnLeft(t)
carre(t, x/3, seuil)
turnRight(t)
carre(t, x/3, seuil)
turnRight(t)
carre(t, x/3, seuil)
turnLeft(t)
carre(t, x/3, seuil)
if __name__ == "__main__":
turtle = umonsTurtle()
turtle.speed(0)
carre(turtle, 200, 5)
wait()