Created
April 7, 2015 18:50
-
-
Save fabian57/20c30926686899169f39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
height = input("How high should it be?") | |
levels = input("How many levels should it have?") | |
import turtle | |
t = turtle.Turtle() | |
t.speed(0) | |
t.hideturtle() | |
t.penup() | |
t.left(90) | |
t.backward(height*2) | |
t.pendown() | |
def tree(length, level): | |
t.forward(length) | |
if level == 0: | |
return | |
else: | |
t.right(10) | |
tree(length*0.8, level-1) | |
t.penup() | |
t.backward(length*0.8) | |
t.pendown() | |
t.left(20) | |
tree(length*0.8, level-1) | |
t.penup() | |
t.backward(length*0.8) | |
t.pendown() | |
t.right(10) | |
tree(height, levels) | |
raw_input("Press ENTER to close the turtle window.") | |
turtle.bye() |
Ils sont trop cools les arbres, j'en fait depuis deux heures
lol, des aléatoires alors?
on attend ta galerie!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oui, t'as raison, mais c'est une base pour des arbres aléatoires beaucoup moins ennuyeux!
Rien à redire sur ton programme, c'est très bien.