-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandom walk.py
More file actions
30 lines (25 loc) · 916 Bytes
/
Random walk.py
File metadata and controls
30 lines (25 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from turtle import Turtle, Screen
import random
t = Turtle()
t.shape("classic")
t.color("green", 'blue')
t.pensize(10)
t.speed("fastest")
c = ["red","blue","cyan","green","black","grey","purple","violet","pink","turquoise","magenta","orange","darkblue",
"aqua","maroon","white","lightgreen","lightblue","brown","darkgreen","lime","gold","silver","tomato",
"chocolate","plum","indigo","lavender","crimson","rosybrown","bisque","salmon","greenyellow","palegreen",
"firebrick","olive"]
#def rand_colour():
# r = random.randint(0,255)
# g = random.randint(0, 255)
# b = random.randint(0, 255)
# return (r,g,b)
while True:
t.pencolor(random.choice(c))
t.right(random.randint(0, 365))
t.fd(random.randint(20,100))
#m = random.randint(1,100000) #Can be used to relay the pen bck to origin randomly.
#if m%12 == 0:
# t.home()
screen = Screen()
screen.exitonclick()