-DECLARE SUB PlaceCube (x!, y!, z!)\r
-DECLARE SUB DrawCube (x!, y!, z!)\r
-\r
-DECLARE SUB CreateCollisionData ()\r
-DECLARE SUB UpdateCollisionData ()\r
-DECLARE SUB RenderScene ()\r
-DECLARE SUB InitializeEnvironment ()\r
-DECLARE SUB StartGame ()\r
-DIM SHARED numPoints, numLines, pointCount, lineCount\r
-DIM SHARED pointsX(1 TO 3000), pointsY(1 TO 3000), pointsZ(1 TO 3000)\r
-DIM SHARED renderedPointsX(1 TO 7000), renderedPointsY(1 TO 7000)\r
-DIM SHARED originalRenderedPointsX(0 TO 9000), originalRenderedPointsY(0 TO 9000)\r
-DIM SHARED oldPointCount, oldLineCount\r
-DIM SHARED lineVertices1(1 TO 3800), lineVertices2(1 TO 3800), lineColors(1 TO 3800)\r
-DIM SHARED originalLineVertices1(1 TO 3800), originalLineVertices2(1 TO 3800)\r
-DIM SHARED myPositionX, myPositionY, myPositionZ\r
-DIM SHARED myPreviousPositionX, myPreviousPositionY, myPreviousPositionZ\r
-DIM SHARED angle1, angle2\r
-DIM SHARED angle1Str, angle2Str\r
-DIM SHARED frameCount\r
-\r
-DIM SHARED gameOfLifeGrid(1 TO 50, 1 TO 50)\r
-DIM SHARED nextGameOfLifeGrid(1 TO 50, 1 TO 50)\r
-\r
-StartGame\r
-' InitializeEnvironment\r
-\r
-angle1 = 1.5\r
-10\r
-frameCount = frameCount + 1\r
-\r
-CreateCollisionData\r
-RenderScene\r
-\r
-myPositionX = SIN(frameCount / 20) * 12\r
-myPositionY = SIN(frameCount / 50) * 10 + 15\r
-myPositionZ = COS(frameCount / 20) * 12\r
-\r
-angle1 = angle1 - .05\r
-angle2 = 2.2 + SIN(frameCount / 50) / 2\r
-\r
-inputKey$ = INKEY$\r
-IF inputKey$ <> "" THEN SYSTEM\r
-GOTO 10\r
-\r
-SUB CreateCollisionData\r
-pointCount = numPoints\r
-lineCount = numLines\r
-\r
-FOR y = 1 TO 50\r
- FOR x = 1 TO 50\r
- IF gameOfLifeGrid(x, y) = 1 THEN\r
- v = ABS(x - 26) + ABS(y - 26) + frameCount\r
- PlaceCube x - 25, SIN(v / 5) * 5, y - 25\r
- END IF\r
- NEXT x\r
-NEXT y\r
-\r
-IF frameCount \ 10 = frameCount / 10 THEN\r
-\r
-FOR y = 2 TO 49\r
-FOR x = 2 TO 49\r
-c = gameOfLifeGrid(x - 1, y - 1)\r
-c = c + gameOfLifeGrid(x, y - 1)\r
-c = c + gameOfLifeGrid(x + 1, y - 1)\r
-c = c + gameOfLifeGrid(x - 1, y)\r
-c = c + gameOfLifeGrid(x + 1, y)\r
-c = c + gameOfLifeGrid(x - 1, y + 1)\r
-c = c + gameOfLifeGrid(x, y + 1)\r
-c = c + gameOfLifeGrid(x + 1, y + 1)\r
-\r
-IF gameOfLifeGrid(x, y) = 1 THEN\r
- IF (c > 3) OR (c < 2) THEN nextGameOfLifeGrid(x, y) = 0 ELSE nextGameOfLifeGrid(x, y) = 1\r
-ELSE\r
- IF c = 3 THEN nextGameOfLifeGrid(x, y) = 1 ELSE nextGameOfLifeGrid(x, y) = 0\r
-END IF\r
-NEXT x\r
-NEXT y\r
-\r
-FOR y = 1 TO 50\r
-FOR x = 1 TO 50\r
- gameOfLifeGrid(x, y) = nextGameOfLifeGrid(x, y)\r
-NEXT x\r
-NEXT y\r
-END IF\r
-\r
-END SUB\r
-\r
-SUB InitializeEnvironment\r
-FOR z = -5 TO 5\r
-FOR x = -5 TO 5\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = x\r
-pointsY(pointCount) = 0\r
-pointsZ(pointCount) = z\r
-IF x > -5 THEN\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount\r
-lineVertices2(lineCount) = pointCount - 1\r
-lineColors(lineCount) = 1\r
-END IF\r
-IF z > -5 THEN\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount\r
-lineVertices2(lineCount) = pointCount - 10\r
-lineColors(lineCount) = 1\r
-END IF\r
-NEXT x\r
-NEXT z\r
-\r
-numPoints = pointCount\r
-numLines = lineCount\r
-\r
-END SUB\r
-\r
-SUB InitializeEnvironment1\r
-pointCount = 1\r
-pointsX(pointCount) = -2\r
-pointsY(pointCount) = 0\r
-pointsZ(pointCount) = 0\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = 2\r
-pointsY(pointCount) = 0\r
-pointsZ(pointCount) = 0\r
-\r
-lineCount = 1\r
-lineVertices1(lineCount) = 1\r
-lineVertices2(lineCount) = 2\r
-lineColors(lineCount) = 14\r
-\r
-END SUB\r
-\r
-SUB PlaceCube (x, y, z)\r
-\r
-v = 3\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 1\r
-lineVertices2(lineCount) = pointCount + 2\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 2\r
-lineVertices2(lineCount) = pointCount + 3\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 3\r
-lineVertices2(lineCount) = pointCount + 4\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 4\r
-lineVertices2(lineCount) = pointCount + 1\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 5\r
-lineVertices2(lineCount) = pointCount + 6\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 6\r
-lineVertices2(lineCount) = pointCount + 7\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 7\r
-lineVertices2(lineCount) = pointCount + 8\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 8\r
-lineVertices2(lineCount) = pointCount + 5\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 1\r
-lineVertices2(lineCount) = pointCount + 5\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 2\r
-lineVertices2(lineCount) = pointCount + 6\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 3\r
-lineVertices2(lineCount) = pointCount + 7\r
-lineColors(lineCount) = v\r
-\r
-lineCount = lineCount + 1\r
-lineVertices1(lineCount) = pointCount + 4\r
-lineVertices2(lineCount) = pointCount + 8\r
-lineColors(lineCount) = v\r
-\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = x - .5\r
-pointsY(pointCount) = y\r
-pointsZ(pointCount) = z - .5\r
-\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = x + .5\r
-pointsY(pointCount) = y\r
-pointsZ(pointCount) = z - .5\r
-\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = x + .5\r
-pointsY(pointCount) = y\r
-pointsZ(pointCount) = z + .5\r
-\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = x - .5\r
-pointsY(pointCount) = y\r
-pointsZ(pointCount) = z + .5\r
-\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = x - .5\r
-pointsY(pointCount) = y + 1\r
-pointsZ(pointCount) = z - .5\r
-\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = x + .5\r
-pointsY(pointCount) = y + 1\r
-pointsZ(pointCount) = z - .5\r
-\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = x + .5\r
-pointsY(pointCount) = y + 1\r
-pointsZ(pointCount) = z + .5\r
-\r
-pointCount = pointCount + 1\r
-pointsX(pointCount) = x - .5\r
-pointsY(pointCount) = y + 1\r
-pointsZ(pointCount) = z + .5\r
-\r
-END SUB\r
-\r
-SUB RenderScene\r
-\r
-sineAngle1 = SIN(angle1)\r
-cosineAngle1 = COS(angle1)\r
-sineAngle2 = SIN(angle2)\r
-cosineAngle2 = COS(angle2)\r
-\r
-FOR a = 1 TO pointCount\r
-x = pointsX(a) + myPositionX\r
-y = pointsY(a) - myPositionY\r
-z = pointsZ(a) + myPositionZ\r
-\r
-x1 = x * sineAngle1 - z * cosineAngle1\r
-z1 = x * cosineAngle1 + z * sineAngle1\r
-y1 = y * sineAngle2 - z1 * cosineAngle2\r
-z2 = y * cosineAngle2 + z1 * sineAngle2\r
-\r
-IF z2 < .5 THEN\r
-renderedPointsX(a) = -1\r
-ELSE\r
-renderedPointsX(a) = 320 + (x1 / z2 * 400)\r
-renderedPointsY(a) = 240 - (y1 / z2 * 400)\r
-END IF\r
-NEXT a\r
-\r
-FOR a = 1 TO lineCount\r
-l1 = originalLineVertices1(a)\r
-l2 = originalLineVertices2(a)\r
-\r
-IF originalRenderedPointsX(l1) = -1 OR originalRenderedPointsX(l2) = -1 THEN ELSE LINE (originalRenderedPointsX(l1), originalRenderedPointsY(l1))-(originalRenderedPointsX(l2), originalRenderedPointsY(l2)), 0\r
-l1 = lineVertices1(a)\r
-l2 = lineVertices2(a)\r
-IF renderedPointsX(l1) = -1 OR renderedPointsX(l2) = -1 THEN ELSE LINE (renderedPointsX(l1), renderedPointsY(l1))-(renderedPointsX(l2), renderedPointsY(l2)), lineColors(a)\r
-NEXT a\r
-\r
-IF lineCount < oldLineCount THEN\r
-FOR a = lineCount + 1 TO oldLineCount\r
-l1 = originalLineVertices1(a)\r
-l2 = originalLineVertices2(a)\r
-IF originalRenderedPointsX(l1) = -1 OR originalRenderedPointsX(l2) = -1 THEN ELSE LINE (originalRenderedPointsX(l1), originalRenderedPointsY(l1))-(originalRenderedPointsX(l2), originalRenderedPointsY(l2)), 0\r
-NEXT a\r
-END IF\r
-\r
-FOR a = 1 TO pointCount\r
-originalRenderedPointsX(a) = renderedPointsX(a)\r
-originalRenderedPointsY(a) = renderedPointsY(a)\r
-NEXT a\r
-oldPointCount = pointCount\r
-\r
-FOR a = 1 TO lineCount\r
-originalLineVertices1(a) = lineVertices1(a)\r
-originalLineVertices2(a) = lineVertices2(a)\r
-NEXT a\r
-oldLineCount = lineCount\r
-\r
-END SUB\r
-\r
-SUB StartGame\r
-SCREEN 12\r
-numPoints = 0\r
-numLines = 0\r
-pointCount = numPoints\r
-lineCount = numLines\r
-gridSize = 50\r
-\r
-myPositionX = 4\r
-myPositionY = 15\r
-myPositionZ = 17\r
-angle1 = ATN(1) / 2 - .29\r
-angle2 = angle1 + 1\r
-\r
-FOR a = 1 TO 1000\r
-lineColors(a) = 4\r
-NEXT a\r
-\r
-FOR a = 1 TO 1000\r
-originalLineVertices1(a) = 1\r
-originalLineVertices2(a) = 1\r
-NEXT a\r
-\r
-OPEN "3dlife.dat" FOR INPUT AS #1\r
-y = 20\r
-20\r
-IF EOF(1) <> 0 THEN GOTO 30\r
-x = 20\r
-\r
-LINE INPUT #1, inputLine$\r
-FOR b = 1 TO LEN(inputLine$)\r
- c$ = RIGHT$(LEFT$(inputLine$, b), 1)\r
- IF c$ = "#" THEN gameOfLifeGrid(x, y) = 1\r
- x = x + 1\r
-NEXT b\r
-\r
-y = y + 1\r
-GOTO 20\r
-30\r
-CLOSE #1\r
-\r
-END SUB\r
-\r
+' Program renders rotating 3D animation from cubes.
+' Cubes appear and disappear according to Conway's Game of Life rules.
+
+DECLARE SUB PlaceCube (x!, y!, z!)
+DECLARE SUB DrawCube (x!, y!, z!)
+
+DECLARE SUB CreateCollisionData ()
+DECLARE SUB UpdateCollisionData ()
+DECLARE SUB RenderScene ()
+DECLARE SUB InitializeEnvironment ()
+DECLARE SUB StartGame ()
+
+DIM SHARED numPoints, numLines, pointCount, lineCount
+DIM SHARED pointsX(1 TO 3000), pointsY(1 TO 3000), pointsZ(1 TO 3000)
+DIM SHARED renderedPointsX(1 TO 7000), renderedPointsY(1 TO 7000)
+DIM SHARED originalRenderedPointsX(0 TO 9000), originalRenderedPointsY(0 TO 9000)
+DIM SHARED oldPointCount, oldLineCount
+DIM SHARED lineVertices1(1 TO 3800), lineVertices2(1 TO 3800), lineColors(1 TO 3800)
+DIM SHARED originalLineVertices1(1 TO 3800), originalLineVertices2(1 TO 3800)
+DIM SHARED myPositionX, myPositionY, myPositionZ
+DIM SHARED myPreviousPositionX, myPreviousPositionY, myPreviousPositionZ
+DIM SHARED angle1, angle2
+DIM SHARED angle1Str, angle2Str
+DIM SHARED frameCount
+
+DIM SHARED gameOfLifeGrid(1 TO 50, 1 TO 50)
+DIM SHARED nextGameOfLifeGrid(1 TO 50, 1 TO 50)
+
+StartGame
+
+angle1 = 1.5
+10
+frameCount = frameCount + 1
+
+CreateCollisionData
+RenderScene
+
+myPositionX = SIN(frameCount / 20) * 12
+myPositionY = SIN(frameCount / 50) * 10 + 15
+myPositionZ = COS(frameCount / 20) * 12
+
+angle1 = angle1 - .05
+angle2 = 2.2 + SIN(frameCount / 50) / 2
+
+inputKey$ = INKEY$
+IF inputKey$ <> "" THEN SYSTEM
+GOTO 10
+
+SUB CreateCollisionData
+pointCount = numPoints
+lineCount = numLines
+
+FOR y = 1 TO 50
+ FOR x = 1 TO 50
+ IF gameOfLifeGrid(x, y) = 1 THEN
+ v = ABS(x - 26) + ABS(y - 26) + frameCount
+ PlaceCube x - 25, SIN(v / 5) * 5, y - 25
+ END IF
+ NEXT x
+NEXT y
+
+IF frameCount \ 10 = frameCount / 10 THEN
+
+FOR y = 2 TO 49
+FOR x = 2 TO 49
+c = gameOfLifeGrid(x - 1, y - 1)
+c = c + gameOfLifeGrid(x, y - 1)
+c = c + gameOfLifeGrid(x + 1, y - 1)
+c = c + gameOfLifeGrid(x - 1, y)
+c = c + gameOfLifeGrid(x + 1, y)
+c = c + gameOfLifeGrid(x - 1, y + 1)
+c = c + gameOfLifeGrid(x, y + 1)
+c = c + gameOfLifeGrid(x + 1, y + 1)
+
+IF gameOfLifeGrid(x, y) = 1 THEN
+ IF (c > 3) OR (c < 2) THEN nextGameOfLifeGrid(x, y) = 0 ELSE nextGameOfLifeGrid(x, y) = 1
+ELSE
+ IF c = 3 THEN nextGameOfLifeGrid(x, y) = 1 ELSE nextGameOfLifeGrid(x, y) = 0
+END IF
+NEXT x
+NEXT y
+
+FOR y = 1 TO 50
+FOR x = 1 TO 50
+ gameOfLifeGrid(x, y) = nextGameOfLifeGrid(x, y)
+NEXT x
+NEXT y
+END IF
+
+END SUB
+
+SUB InitializeEnvironment
+FOR z = -5 TO 5
+FOR x = -5 TO 5
+pointCount = pointCount + 1
+pointsX(pointCount) = x
+pointsY(pointCount) = 0
+pointsZ(pointCount) = z
+IF x > -5 THEN
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount
+lineVertices2(lineCount) = pointCount - 1
+lineColors(lineCount) = 1
+END IF
+IF z > -5 THEN
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount
+lineVertices2(lineCount) = pointCount - 10
+lineColors(lineCount) = 1
+END IF
+NEXT x
+NEXT z
+
+numPoints = pointCount
+numLines = lineCount
+
+END SUB
+
+SUB InitializeEnvironment1
+pointCount = 1
+pointsX(pointCount) = -2
+pointsY(pointCount) = 0
+pointsZ(pointCount) = 0
+pointCount = pointCount + 1
+pointsX(pointCount) = 2
+pointsY(pointCount) = 0
+pointsZ(pointCount) = 0
+
+lineCount = 1
+lineVertices1(lineCount) = 1
+lineVertices2(lineCount) = 2
+lineColors(lineCount) = 14
+
+END SUB
+
+SUB PlaceCube (x, y, z)
+
+v = 3
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 1
+lineVertices2(lineCount) = pointCount + 2
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 2
+lineVertices2(lineCount) = pointCount + 3
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 3
+lineVertices2(lineCount) = pointCount + 4
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 4
+lineVertices2(lineCount) = pointCount + 1
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 5
+lineVertices2(lineCount) = pointCount + 6
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 6
+lineVertices2(lineCount) = pointCount + 7
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 7
+lineVertices2(lineCount) = pointCount + 8
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 8
+lineVertices2(lineCount) = pointCount + 5
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 1
+lineVertices2(lineCount) = pointCount + 5
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 2
+lineVertices2(lineCount) = pointCount + 6
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 3
+lineVertices2(lineCount) = pointCount + 7
+lineColors(lineCount) = v
+
+lineCount = lineCount + 1
+lineVertices1(lineCount) = pointCount + 4
+lineVertices2(lineCount) = pointCount + 8
+lineColors(lineCount) = v
+
+pointCount = pointCount + 1
+pointsX(pointCount) = x - .5
+pointsY(pointCount) = y
+pointsZ(pointCount) = z - .5
+
+pointCount = pointCount + 1
+pointsX(pointCount) = x + .5
+pointsY(pointCount) = y
+pointsZ(pointCount) = z - .5
+
+pointCount = pointCount + 1
+pointsX(pointCount) = x + .5
+pointsY(pointCount) = y
+pointsZ(pointCount) = z + .5
+
+pointCount = pointCount + 1
+pointsX(pointCount) = x - .5
+pointsY(pointCount) = y
+pointsZ(pointCount) = z + .5
+
+pointCount = pointCount + 1
+pointsX(pointCount) = x - .5
+pointsY(pointCount) = y + 1
+pointsZ(pointCount) = z - .5
+
+pointCount = pointCount + 1
+pointsX(pointCount) = x + .5
+pointsY(pointCount) = y + 1
+pointsZ(pointCount) = z - .5
+
+pointCount = pointCount + 1
+pointsX(pointCount) = x + .5
+pointsY(pointCount) = y + 1
+pointsZ(pointCount) = z + .5
+
+pointCount = pointCount + 1
+pointsX(pointCount) = x - .5
+pointsY(pointCount) = y + 1
+pointsZ(pointCount) = z + .5
+
+END SUB
+
+SUB RenderScene
+
+sineAngle1 = SIN(angle1)
+cosineAngle1 = COS(angle1)
+sineAngle2 = SIN(angle2)
+cosineAngle2 = COS(angle2)
+
+FOR a = 1 TO pointCount
+x = pointsX(a) + myPositionX
+y = pointsY(a) - myPositionY
+z = pointsZ(a) + myPositionZ
+
+x1 = x * sineAngle1 - z * cosineAngle1
+z1 = x * cosineAngle1 + z * sineAngle1
+y1 = y * sineAngle2 - z1 * cosineAngle2
+z2 = y * cosineAngle2 + z1 * sineAngle2
+
+IF z2 < .5 THEN
+renderedPointsX(a) = -1
+ELSE
+renderedPointsX(a) = 320 + (x1 / z2 * 400)
+renderedPointsY(a) = 240 - (y1 / z2 * 400)
+END IF
+NEXT a
+
+FOR a = 1 TO lineCount
+l1 = originalLineVertices1(a)
+l2 = originalLineVertices2(a)
+
+IF originalRenderedPointsX(l1) = -1 OR originalRenderedPointsX(l2) = -1 THEN
+ELSE
+LINE (originalRenderedPointsX(l1), originalRenderedPointsY(l1))-(originalRenderedPointsX(l2), originalRenderedPointsY(l2)), 0
+END IF
+
+l1 = lineVertices1(a)
+l2 = lineVertices2(a)
+IF renderedPointsX(l1) = -1 OR renderedPointsX(l2) = -1 THEN
+ELSE
+LINE (renderedPointsX(l1), renderedPointsY(l1))-(renderedPointsX(l2), renderedPointsY(l2)), lineColors(a)
+END IF
+NEXT a
+
+IF lineCount < oldLineCount THEN
+FOR a = lineCount + 1 TO oldLineCount
+l1 = originalLineVertices1(a)
+l2 = originalLineVertices2(a)
+IF originalRenderedPointsX(l1) = -1 OR originalRenderedPointsX(l2) = -1 THEN
+ELSE
+LINE (originalRenderedPointsX(l1), originalRenderedPointsY(l1))-(originalRenderedPointsX(l2), originalRenderedPointsY(l2)), 0
+END IF
+NEXT a
+END IF
+
+FOR a = 1 TO pointCount
+originalRenderedPointsX(a) = renderedPointsX(a)
+originalRenderedPointsY(a) = renderedPointsY(a)
+NEXT a
+
+oldPointCount = pointCount
+
+FOR a = 1 TO lineCount
+originalLineVertices1(a) = lineVertices1(a)
+originalLineVertices2(a) = lineVertices2(a)
+NEXT a
+
+oldLineCount = lineCount
+
+END SUB
+
+SUB StartGame
+SCREEN 12
+numPoints = 0
+numLines = 0
+pointCount = numPoints
+lineCount = numLines
+gridSize = 50
+
+myPositionX = 4
+myPositionY = 15
+myPositionZ = 17
+angle1 = ATN(1) / 2 - .29
+angle2 = angle1 + 1
+
+FOR a = 1 TO 1000
+lineColors(a) = 4
+NEXT a
+
+FOR a = 1 TO 1000
+originalLineVertices1(a) = 1
+originalLineVertices2(a) = 1
+NEXT a
+
+OPEN "3dlife.dat" FOR INPUT AS #1
+y = 20
+20
+IF EOF(1) <> 0 THEN GOTO 30
+x = 20
+
+LINE INPUT #1, inputLine$
+FOR b = 1 TO LEN(inputLine$)
+ c$ = RIGHT$(LEFT$(inputLine$, b), 1)
+ IF c$ = "#" THEN gameOfLifeGrid(x, y) = 1
+ x = x + 1
+NEXT b
+
+y = y + 1
+GOTO 20
+30
+CLOSE #1
+
+END SUB