moving files

This commit is contained in:
Debucquoy
2023-02-15 13:40:50 +01:00
parent 93ae5a67d2
commit 2109fa74c0
81 changed files with 126 additions and 0 deletions

40
q1/04oct/ex6.py Normal file
View File

@ -0,0 +1,40 @@
from uturtle import (
umonsTurtle, wait,
moveForward, moveBackward,
turnLeft, turnRight,
dropPen, usePen)
def arbre(t, x, a, n):
"""draw a tree
:t: turtle
:x: taille du tronc de base
:a: angle des branches
:n: profondeur de l'arbre
"""
moveForward(t, x)
arbre_rec(t, x, a, n)
def arbre_rec(t, x, a, n):
if n == 0:
return
turnLeft(t, a/2)
moveForward(t, x)
arbre_rec(t, x*5/6, a*5/6, n-1)
moveBackward(t, x)
turnRight(t, a)
moveForward(t, x)
arbre_rec(t, x*5/6, a*5/6, n-1)
moveBackward(t, x)
turnLeft(t, a/2)
if __name__ == "__main__":
turtle = umonsTurtle()
turnLeft(turtle)
arbre(turtle, 50, 45, 4)
wait()