-
Notifications
You must be signed in to change notification settings - Fork 0
/
9-26-16.py
52 lines (45 loc) · 1.13 KB
/
9-26-16.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 26 15:23:38 2016
@author: Graham Cooke
"""
from turtle import *
directionsOut = ''
directionsBase = 'FA'
n = 12
l = 5
def iterate(n):
global directionsOut
global directionsBase
for n in range(n):
for letter in directionsBase:
if(letter == 'F'):
directionsOut = directionsOut + 'F'
elif(letter == 'R'):
directionsOut = directionsOut + 'R'
elif(letter == 'L'):
directionsOut = directionsOut + 'L'
elif(letter == 'A'):
directionsOut = directionsOut + 'ARBF'
elif(letter == 'B'):
directionsOut = directionsOut + 'FALB'
directionsBase = directionsOut
directionsOut = ''
def draw():
global directionsBase
global l
for letter in directionsBase:
if(letter == 'F'):
t.forward(l)
elif(letter == 'R'):
t.right(90)
elif(letter == 'L'):
t.left(90)
screen = Screen()
t = Turtle()
t.speed(100)
iterate(n)
draw()
t.hideturtle()
screen.exitonclick()
print(directionsBase)