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