Created
October 3, 2018 17:46
-
-
Save PaulPolaschek/14e73a9c36e3eda0d197d282ce692ca5 to your computer and use it in GitHub Desktop.
python3 turtle
This file contains 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
import turtle | |
import random | |
rosi = turtle.Turtle() | |
rosi.speed(0) | |
rosi.shape("turtle") | |
rosi.pensize(2) | |
rosi.pencolor("green") | |
rosi.fillcolor("red") | |
rosi.goto(-100,-50) | |
rosi.k = 0.12 | |
susi = turtle.Turtle() | |
susi.speed(0) | |
susi.shape("turtle") | |
susi.pensize(2) | |
susi.pencolor("red") | |
susi.fillcolor("blue") | |
susi.goto(100,-20) | |
susi.k = 0.245 | |
franzi = turtle.Turtle() | |
franzi.speed(0) | |
franzi.shape("turtle") | |
franzi.pensize(2) | |
franzi.pencolor("black") | |
franzi.fillcolor("purple") | |
franzi.goto(0,20) | |
franzi.k = 0.053 | |
rosi.clear() | |
susi.clear() | |
franzi.clear() | |
rosi.setheading(0) | |
susi.setheading(120) | |
franzi.setheading(240) | |
for x in range(100): | |
for t in (rosi, susi, franzi): | |
t.fd(random.randint(-20,90)) | |
t.left(random.randint(-30,30)) | |
if random.random() < t.k: | |
radius = random.randint(20, 120) | |
winkel = random.randint(0, 360) | |
vorzeichen = random.choice((1,-1)) | |
t.circle(radius, winkel * vorzeichen) | |
if t.distance((0,0)) > 500: | |
#t.penup() | |
#t.home() | |
#t.pendown() | |
t.setheading(t.towards(0,0)) | |
t.fd(random.randint(100,600)) | |
turtle.exitonclick() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment