def board(side): for i in range(0,8): row(side) move(side) turn(-90) move(side*8) turn(90)
def squares_loop(side): for i in range(0,10): turn(90) move(side) turn(90) move(8*side) turn(-180)
def waterwheel(edges, size): angle = 210.0 decoration = size / 2 for i in range(0, edges): move(size) square(decoration) turn(angle)
def board(side): for i in range(0, 8): row(side) move(side) turn(-90) move(side * 8) turn(90)
def waterwheel(edges, size): angle = 360 / edges decoration = size / 2 for i in range(0, edges): move(size) shape(decoration, 3) turn(angle)
def squares_loop(side): for i in range(0, 10): turn(90) move(side) turn(90) move(8 * side) turn(-180)
def waterwheel(edges, size): #side = sidelength angle = 360 / edges #finds angle between each edge decoration = size / 2 #makes square side length half size for i in range(0, edges): move(size) square(decoration) turn(angle)
def waterwheel(edges, size): angle = 360 / edges decoration = size /3 for i in range(0, edges): move(size) triangle(decoration) turn(angle)
def waterwheel(edges, size): angle = 360 / edges decoration = size / 2 for i in range(0, edges): move(size) square(decoration) turn(angle)
def waterwheel(edges, size): angle = 400 / edges decoration = size / 6 for i in range(0, edges): move(size) square(decoration) turn(angle)
def waterwheel(edges, size): #Drawing waterwheel angle = 360 / edges decoration = size / 2 for i in range(0, edges): move(size) square(decoration) turn(angle)
def spiral(size): #function with var size if size > 300: #end function once var size > return move(size) #move size pixels turn(90) #rotate spiral(size + 5) #increase size by 5
def waterwheel(edges, size): angle = 360 / edges decoration = size / 4 for i in range(0, edges): move(size) #square(decoration) circle(500) turn(angle)
def spiral(size): if size > 300: return move(size) turn(35) spiral(size + 5)
def spiral(size): if size > 500: return move(size) turn(91) spiral(size + 5)
def spiral(size): if size > 300: return move(size) turn(90) spiral(size + 10)
def spiral(size): if size > 300: return move(size) turn(60) spiral(size + 5)
def spiral(size): if size > 300: #terminate after 300 rounds return move(size) turn(60) #interior angle spiral(size + 5) #make new side slightly bigger
def blacksquare(size): if size > 300: return move(size) turn(90) blacksquare(size + 0.5)
def spiral(size): if size > 400: return move(size) turn(91) spiral(size + 5)
def segment(scale, detail): if detail == 0: None else: for i in range(0, 3): move(scale) turn(120) segment(scale / 2, detail - 1)
def handle_frame(): global d for x in range(10): d+=1 color("hsl(%d,100%%,50%%)" % d) move(random()*5) turn(random()*90 - 45)
def grid(number, size): for i in range(number): line_squares(number, size) if (i != (number - 1)): turn(-90) move(size * number) turn(-90) move(size) turn(180)
def spiral(size): if size > 300: return color("RGB(255,10,0)") move(size) turn(120) spiral(size + 8)
def handle_frame(): global d for x in range(10): d += 1 color("hsl(%d,100%%,50%%)" % d) move(random() * 5) turn(random() * 90 - 45)
def trifrac(level, scale): if level == 0: return tri(scale) for i in range(3): move(scale) turn(120) trifrac(level - 1, scale/2)
def trifrac(level, scale): if level == 0: return tri(scale) for i in range(3): move(scale) turn(120) trifrac(level - 1, scale / 2)
def waterwheel(edges, size): angle = 360 / edges decoration = size / 1 dec = size/3 for i in range(0, edges): move(size) square(decoration) square(dec) turn(angle)
def grid(number,size): for i in range(number): line_squares(number,size) if (i!=(number-1)): turn(-90) move(size*number) turn(-90) move(size) turn(180)
def gradientmove(distance, r1, g1, b1, a1, r2, g2, b2, a2, step=10): for i in range(0, distance, step): j = distance - i col = ("rgba(%d, %d, %d, %d" % ((r1 * j + r2 * i) / distance, (g1 * j + g2 * i) / distance, (b1 * j + b2 * i) / distance, (a1 * j + a2 * i) / distance)) color(col) move(step)
def segment(scale, detail): if detail == 0: move(scale) else: segment(scale / 1.0, detail - 1) turn(120) segment(scale / 1.0, detail - 1) turn(60) segment(scale / 1.0, detail - 1) turn(60)
def segment(scale, detail): if detail == 0: move(scale) else: segment(scale / 3.0, detail - 3) turn(-60) segment(scale / 3.0, detail - 3) turn(120) segment(scale / 3.0, detail - 3) turn(-60) segment(scale / 3.0, detail - 3)
def segment(scale, detail): if detail == 0: move(scale) else: segment(scale / 3.0, detail - 1) turn(-60) segment(scale / 3.0, detail - 1) turn(120) segmnt(scale / 3.0, detail - 1) turn(-60) segment(scale / 3.0, detail - 1)
def segment(scale, detail, ratio): if detail == 0: None else: move(scale) turn(45) segment(scale * ratio, detail - 1, ratio) turn(-90) segment(scale * ratio, detail - 1, ratio) turn(45) move(-scale)
def blackSquare(size): #starts + ends top left for i in xrange(0,size): move(size) turn(-90) move(1) turn(-90) if (size%2 == 1): move(size) turn(90) move(size) else: turn(90) move(size)
def gradientmove(distance, r1, g1, b1, a1, r2, g2, b2, a2, step=10): for i in range(0, distance, step): j = distance - i col = ("rgba(%d, %d, %d, %d" % ((r1*j + r2*i)/distance, (g1*j + g2*i)/distance, (b1*j + b2*i)/distance, (a1*j + a2*i)/distance)) color(col) move(step)
def horizontal_lines(squaresize): for i in range(0,4): move(squaresize) turn(90) move(gridsize) turn(-90) move(squaresize) turn(-90) move(gridsize) turn(90)
def fillSquare(sideLength): for i in range(0,sideLength/2): move(sideLength) turn(90) move(1) turn(90) move(sideLength) turn(-90) move(1) turn(-90)
def drawlines(size): for i in range(4): move(size/8) turn(-90) move(size) turn(90) move(size/8) turn(90) move(size) turn(-90)
def vertical_lines(squaresize): for i in range(0,4): turn(90) move(squaresize) turn(-90) move(gridsize) turn(90) move(squaresize) turn(90) move(gridsize) turn(180)
def tri(size): move(size) turn(120) move(size) turn(120) move(size) turn(120)
def chessboard(): sqSize = 8 for i in range(0, 8): for j in range(0, 8): square(sqSize) move(sqSize) turn(180) move(8 * sqSize) turn(-90) move(8) turn(-90)
def segment(scale, detail): move(scale) turn(120) if detail > 0: segment(scale / 2, detail - 1) move(scale) turn(120) if detail > 0: segment(scale / 2, detail - 1) move(scale) turn(120) if detail > 0: segment(scale / 2, detail - 1)
def sierpinsky (scale, detail): if (detail>0) : move(scale) turn(120) sierpinsky(scale/2, detail-1) if (detail>0) : move(scale) turn(120) sierpinsky(scale/2, detail-1) if (detail>0) : move(scale) turn(120) sierpinsky(scale/2, detail-1)
def segment(scale, detail): if detail == 0: for i in range (0,3): move(scale) turn(-120) else: segment(scale / 3.0, detail - 1) turn(-60) segment(scale / 3.0, detail - 1) turn(120) segment(scale / 3.0, detail - 1) turn(-60) segment(scale / 3.0, detail - 1) turn(90) move(-300) segment(600,0) move(-300)
def segment(scale, n, pos): if n == 0: return else: if (pos == 0): tri(scale) elif (pos == 1): move(scale) tri(scale) elif (pos == 2): turn(120) move(scale) turn(-120) tri(scale) turn(-120) move(scale) turn(120) segment(scale / 2, n - 1, 0) segment(scale / 2, n - 1, 1) segment(scale / 2, n - 1, 2)
def polygon(edges, size): angle = 360.0 / edges for i in range(0, edges): move(size) turn(angle)
from tealight.logo import (move, turn, color) colors = ["red", "green", "blue"] r = 100 for i in range(0, r): move(10) turn(360.0 / r) color(colors[i % 3])
def square(side): for i in range(0, 4): move(side) turn(90)
from tealight.logo import move, turn, color def square(side): for i in range(0, 4): move(side) turn(90) for j in range(0, 8): for i in range(0, 8): square(30) move(30) move(-30 * 8) turn(90) move(30) turn(-90)
from tealight.logo import (move, turn, color) print "This is tealight!" colors = ["red", "blue", "green"] for i in range(10, 200, 5): move(i) turn(83) c = colors[(i / 5) % 3] color(c)
def triangle(size): angle = 360.0 / 3 for i in range(0, 3): move(size) turn(angle)
from tealight.logo import move, turn # Draws the von Koch Snowflake curve def segment(scale, detail): if detail == 0: move(scale) else: segment(scale / 3.0, detail - 1) turn(-60) segment(scale / 3.0, detail - 1) turn(120) segmnt(scale / 3.0, detail - 1) turn(-60) segment(scale / 3.0, detail - 1) turn(90) move(-300) segment(600, 6) move(-300)