programs/triangleWheel.toby
author Ryan C. Gordon <icculus@icculus.org>
Tue, 18 Mar 2008 02:05:22 +0000
changeset 499 96e88f292dc8
parent 1 d7cb562e4e24
permissions -rw-r--r--
Updated Lua from 5.1.1 to 5.1.3.
icculus@1
     1
function main() returns nothing
icculus@1
     2
	number i
icculus@1
     3
icculus@1
     4
	for i = 1 to 4
icculus@1
     5
		triangleWheel(120, 12)
icculus@1
     6
		triangleWheel(80, 12)
icculus@1
     7
		triangleWheel(40, 12)
icculus@1
     8
		turnRight(90)
icculus@1
     9
	endfor
icculus@1
    10
endfunction
icculus@1
    11
icculus@1
    12
function triangleWheel(number size, number angle) returns nothing
icculus@1
    13
	number i
icculus@1
    14
icculus@1
    15
	for i = 1 to 360 / angle
icculus@1
    16
		isosceles(size)
icculus@1
    17
		turnRight(angle)
icculus@1
    18
	endfor
icculus@1
    19
endfunction
icculus@1
    20
icculus@1
    21
icculus@1
    22
function isosceles(number size) returns nothing
icculus@1
    23
	number i
icculus@1
    24
icculus@1
    25
	for i = 1 to 3
icculus@1
    26
		goForward(size)
icculus@1
    27
		turnRight(60)
icculus@1
    28
	endfor
icculus@1
    29
endfunction
icculus@1
    30
icculus@1
    31