5     ''' ************************************
10    '' **  SILICON-LIFE By Eric Thornton **
20    '' **     For ST Applications 1987   **
30    '' ************************************
40    openw 2:fullw 2:clearw 2
50    Dim r%(15),g%(15),b%(15)
60    Dim Cx(30),Cy(30),Lx(30),Ly(30)
70    flag=1: Gosub Cfixr
80    Gosub Getres
90    reg=0:r=0:g=0:b=0:gosub setcolor
100   reg=3:r=6:g=0:b=3:gosub setcolor
110   reg=2:r=0:g=4:b=6:gosub setcolor
120   reg=1:r=5:g=5:b=5:gosub setcolor
130   Ox=Int(Maxx/2)
140   Oy=70
150   Sz=9
160   Sz2=4
170   For X=0 To 14
180   Cx(X)=Ox
190   Cy(X)=Oy
200   Lx(X)=Cx(X)
210   Ly(X)=Cy(X)
220   Next X
230   For X=15 To 30
240   Cx(X)=Ox
250   Cy(X)=Oy+40
260   Lx(X)=Cx(X)
270   Ly(X)=Cy(X)
280   Next X
290   J=0
300   C=1
310   Color 1,1,C
320   while j<10
330   '  ' BLUE lifeform
340   Color 1,1,2
350   For I=0 To 14
360   Cx=Cx(I):Cy=Cy(I):Gosub Nwx
370   Cx=Cx(I):Cy=Cy(I):Gosub Nwy
380   Cx(I)=Cx(I)+Dx
390   Cy(I)=Cy(I)+Dy
400   Px=Cx(I):Py=Cy(I):Gosub Point
410   If C=3 then goto otherwise
420   Linef Lx(I),Ly(I),Cx(I),Cy(I)
430   Lx(I)=Cx(I)
440   Ly(I)=Cy(I)
450   otherwise:'
460   Next I
470   '  '
480   '  ' RED  Lifeform
490   Color 1,1,3
500   For I=15 to 30
510   Cx=Cx(I):Cy=Cy(I):Gosub Nwx
520   Cx=Cx(I):Cy=Cy(I):Gosub Nwy
530   Cx(I)=Cx(I)+Dx
540   Cy(I)=Cy(I)+Dy
550   Px=Cx(I):Py=Cy(I):Gosub Point
560   If C=2 then goto otherwise2
570   Linef Lx(I),Ly(I),Cx(I),Cy(I)
580   Lx(I)=Cx(I)
590   Ly(I)=Cy(I)
600   otherwise2:'
610   Next I
620   j=j+1
630   wend
640   goto dne
650   Nwx:
660   Dx=int(rnd(1)*Sz)-Sz2
670   If (Cx+Dx)<=0 Or (Cx+Dx)>=Maxx Then Dx=-Dx
700   Return
710   Nwy:
720   Dy=int(rnd(1)*Sz)-Sz2
730   If (Cy+Dy)<=0 Or (Cy+Dy)>=Maxy Then Dy=-Dy
740   Return
750   Dne:'
770   'Procedure Dne
780   flag=0:  Gosub Cfixr
790   End
800   Return
810   Cfixr:c=contrl:io=intout:ii=intin
820   while flag=1:for x=0 to 15:poke c,26:poke c+2,0:poke c+6,2
830   poke ii,x:poke ii+2,0:vdisys(0)
840   r%(x)=peek(intout+2):g%(x)=peek(intout+4):b%(x)=peek(intout+6):next x
850   flag=2:wend
860   while flag=0:for x=0 to 15:poke contrl,14:poke contrl+2,0:poke contrl+6,4
870   poke intin,x:poke intin+2,r%(x):poke intin+4,g%(x)
880   poke intin+6,b%(x):vdisys(0):next x
890   flag=2:wend
910   Return
920   Getres:'
930   Res=peek(systab)
940   If Res<>4 then goto ntlow
950   Maxc=16
960   Maxx=329
970   Maxy=199
980   ntlow:'
990   If Res<>2 then goto ntmed
1000  Maxc=4
1010  Maxx=639
1020  Maxy=199
1030  ntmed:'
1040  If Res<>1 then goto nthi
1050  Maxc=1
1060  Maxx=639
1070  Maxy=399
1080  nthi:'
1090  Return
1100  setcolor:'
1110  poke contrl,14:poke contrl+2,0:poke contrl+6,4:poke intin,reg
1120  poke intin+2,(r*125)+62:poke intin+4,(g*125)+62
1130  poke intin+6,(b*125)+62:vdisys(0):return
1200  point:poke contrl,105:poke contrl+2,1:poke contrl+6,0
1210  poke ptsin,px:poke ptsin+2,py:vdisys(0):c=peek(intout+2):return
