programs/testMultiTurtling.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
//---------------------------------------------------------
icculus@1
     2
// A basic test of multiturtling capabilities.
icculus@1
     3
//
icculus@1
     4
//   This should have four turtles each draw
icculus@1
     5
//    a circle, so you get a diamond-like
icculus@1
     6
//    cluster. The north circle should be blue,
icculus@1
     7
//    the west green, east cyan, and south red.
icculus@1
     8
//
icculus@1
     9
//  Written by Ryan C. Gordon.
icculus@1
    10
//   Copyright (c) Lighting and Sound Technologies, 2000.
icculus@1
    11
//---------------------------------------------------------
icculus@1
    12
icculus@1
    13
function main() returns nothing
icculus@1
    14
	number i
icculus@1
    15
	number turtleId
icculus@1
    16
icculus@1
    17
	disableFence()
icculus@1
    18
	addTurtle()
icculus@1
    19
	addTurtle()
icculus@1
    20
	addTurtle()
icculus@1
    21
icculus@1
    22
	setPenColor(3)
icculus@1
    23
icculus@1
    24
	useTurtle(1)
icculus@1
    25
	turnRight(90)
icculus@1
    26
	setPenColor(4)
icculus@1
    27
	useTurtle(2)
icculus@1
    28
	turnLeft(90)
icculus@1
    29
	setPenColor(1)
icculus@1
    30
	useTurtle(3)
icculus@1
    31
	turnLeft(180)
icculus@1
    32
	setPenColor(2)
icculus@1
    33
icculus@1
    34
	for i = 1 to 360
icculus@1
    35
		for turtleId = 0 to 3
icculus@1
    36
			useTurtle(turtleId)
icculus@1
    37
			turnRight(1)
icculus@1
    38
			goForward(1)
icculus@1
    39
		endfor
icculus@1
    40
	endfor
icculus@1
    41
endfunction
icculus@1
    42
icculus@1
    43
icculus@1
    44
icculus@1
    45
icculus@1
    46