home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1995 January / 1995-01b.d64 / life (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  151 lines

  1. 30 rem  life  guide 10/86 p. 60
  2. 35 poke53280,6:poke53281,0:poke53272,29:poke53270,199:poke52,47
  3. 40 l$="life                                   "
  4. 45 print"[147][154]"l$
  5. 50 poke56334,peek(56334)and254:poke1,peek(1)and251
  6. 55 x=41971:poke782,0:poke88,0:poke90,0
  7. 60 poke781,17:poke91,224:poke89,64:sysx
  8. 65 poke1,peek(1)or4:poke56334,peek(56334)or1
  9. 70 gosub460
  10. 75 l=14*1024:forx=ltol+242:readr:pokex,r:next
  11. 80 d$="[154]":n$=chr$(0)
  12. 85 forx=1to6:a$=a$+"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@":next
  13. 90 c=5:de=60:j=56320:l(1)=42
  14. 95 rem intro
  15. 100 printd$"          instructions  y/n            "
  16. 105 gosub390:gosub350
  17. 110 sysl+72
  18. 115 forx=1to232:t=ti+300/x
  19. 120 getg$:gosub440:ifg$="y"org$="n"orpeek(j)=111then140
  20. 125 ift>tithen120
  21. 130 sysl
  22. 135 nextx:goto105
  23. 140 ifg$="y"thengosub 485
  24. 145 rem  draw mode
  25. 150 gosub390
  26. 155 print""l$,"    draw mode"d$"f keys: 1=new  3=color  5=help  7=run 
  27. 160 [129]d[178]1[164]1e3:[130]
  28. 165 [153]d$"f keys: 1=new  3=color  5=help  q=quit":[129]d[178]1[164]1e3:[130]
  29. 170 [153]d$"f keys: 1=new  3=color  5=help  7=run 
  30. 175 x=11:y=19
  31. 180 sc=1064+x*40+y:pokesc,l(f)+128
  32. 185 gosub425:pokesc,l(f)
  33. 190 ifa=17orp=125thenifx<22thenx=x+1:goto180
  34. 195 ifa=145orp=126thenifxthenx=x-1:goto180
  35. 200 ifa=29orp=119thenify<37theny=y+1:goto180
  36. 205 ifa=157orp=123thenifytheny=y-1:goto180
  37. 210 ifa=19then175
  38. 215 ifa=13orp=111thenf=1-f
  39. 220 ifa=133thengosub390:goto175
  40. 225 ifa=134thenc=1-c*(c<15):gosub390:goto175
  41. 230 ifa=135thengosub 485:gosub390:goto150
  42. 235 ifa=136then280
  43. 240 ifg$="t"thengosub390:gosub350
  44. 245 ifg$="l"thengosub460
  45. 250 ifg$<>"g"thenifg$<>"s"then180
  46. 255 ifx<2orx>21ory<3ory>36then180
  47. 260 f=0:forz=39to41:pokesc+z,42:next:pokesc+1,42
  48. 265 ifg$="g"thenpokesc-40,42:goto180
  49. 270 pokesc-3,42:pokesc+38,42:pokesc-39,42:pokesc-80,42:goto180
  50. 275 rem  life loop
  51. 280 print"[154]"l$"generation      population":f=0
  52. 285 printd$"f keys: 1=draw  3=slow  5=fast  7=stop":sysl+72:t=ti
  53. 290 print""tab(18)"    "tab(34)"    "
  54. 295 print"[154]"tab(17)g tab(33)peek(249)+peek(250)*256"[157]":g=g+1
  55. 300 getg$:ifg$=""andpeek(j)=127then335
  56. 305 a=asc(g$+n$)
  57. 310 ifa=133then155
  58. 315 ifa=134thende=60
  59. 320 ifa=135thende=0:t=ti
  60. 325 ifa=136orpeek(j)=111thengosub400
  61. 330 ifa=3then445
  62. 335 ift>tithen300
  63. 340 sysl:t=ti+de:goto290
  64. 345 rem  print life
  65. 350 print"":poke646,c
  66. 355 print"*@@@@@*@@****@@****
  67. 360 [153]"*@@@@@*@@*@@@@@*
  68. 365 print"*@@@@@*@@***@@@***
  69. 370 [153]"*@@@@@*@@*@@@@@*
  70. 375 print"****@@*@@*@@@@@****
  71. 380 [142]
  72. 385 [143]  print screen
  73. 390 f[178]1:g[178]0:[151]646,c:[153]""a$a$a$[201](a$,200);:[142]
  74. 395 [143]  stop
  75. 400 [153]d$,,,"  7=run 
  76. 405 ifpeek(j)=111then405
  77. 410 gosub425:printd$,,,"  7=stop":ford=1to1e3:next
  78. 415 printd$,,,"  q=quit":ford=1to1e3:next:printd$,,,"  7=stop":return
  79. 420 rem get
  80. 425 k=0
  81. 430 getg$:p=peek(j):ifg$=""andp=127thenk=1:goto430
  82. 435 ifkthenifp<127thenford=1to222:next
  83. 440 a=asc(g$+n$):ifa<>81thenreturn
  84. 445 poke53272,21:poke53270,200
  85. 450 print"[147]"tab(14)"that's life":ford=1to4e3:next:end
  86. 455 rem poke chrs
  87. 460 restore:lf=1-lf
  88. 465 forz=1to4:readch:fork=0to7:readd:poke12288+8*ch+k,dand(127+128*lf):next
  89. 470 iflf=0thenpoke12288+ch*8+7,0
  90. 475 next
  91. 480 return
  92. 485 gosub390:printl$"[154][146]life@is@asimulationof@thelifeofa
  93. 490 [153]"colonyofcellsfollowingtheserules:"
  94. 495 [153]"list1.survival:acellcellwith2or3
  95. 500 print,"neighborssurvives",,"tothenextgeneration."
  96. 505 printspc(9)"**[145][157][154]*_thiscellhas2neighbors.
  97. 510 [153]"list2.birth:acellisbornineach
  98. 515 print,"areawith3neighbors.
  99. 520 [153][166]8)"**cmdcmd*cont wait_thisareahas3neighbors."
  100. 525 [153]"printputaninitialcolonyonthescreenin
  101. 530 print"thedrawmode,usingthecrsrkeysor
  102. 535 [153]"joystick2.turndrawon/offwiththe
  103. 540 print"joystickbuttonorreturnkey.
  104. 545 [153]"contthecomputerwilldisplaytheliving
  105. 550 print"cellsofeachgeneration.
  106. 555 [153]d$"cont            press  <space>            "
  107. 560 [151]198,0:[141]425:[141]390
  108. 565 [141]390
  109. 570 [153]"listcommonstableforms:
  110. 575 poke646,c:print,,,"**",
  111. 580 print"********
  112. 585 [153]"**********
  113. 590 print"******
  114. 595 [153]"contbeehiveboxblockboatloaf"
  115. 600 [153]"listoscillators:",:[151]646,c
  116. 605 [151]646,c
  117. 610 [153]"***
  118. 615 print,"*******
  119. 620 [153]"**********
  120. 625 print,,"@@**@@@@@@@@@*
  121. 630 [153]"contblinkertoadbeaconclock
  122. 635 print"[155]other forms:",,:poke646,c
  123. 640 print"*
  124. 645 [153],"*****",
  125. 650 [153]"**********
  126. 655 print"************",
  127. 660 print"[154]cp485672pi[176][155]g[154]lider[155]s[154]paceship
  128. 665 [153]"listdraw@commands:conttantantantan<
  129. 670 printspc(19)"[157][173][155]l[154]ineson/off[155]t[154]itle
  130. 675 [141]425:[142]
  131. 680 [131] 0,128,128,128,128,128,128,128,170
  132. 685 [131] 42,128,156,190,190,190,156,128,170
  133. 690 [131] 128,255,255,255,255,255,255,255,255
  134. 695 [131] 170,255,227,193,193,193,227,255,255
  135. 700 [143]  ml data
  136. 705 [131] 169,4,133,252,169,40,133,251,169,64,133,254,169,40,133,253,160
  137. 710 [131] ,177,253,170,224,2,240,10,169,42,224,3,240,2,169,,145,251
  138. 715 [131] 24,165,253,105,1,133,253,165,254,105,,133,254,24,165,251,105,1
  139. 720 [131] 133,251,165,252,105,,133,252,201,7,208,207,165,251,201,192,208
  140. 725 [131] 201,234,169,,133,250,133,249,169,63,133,254,169,255,133,253,169
  141. 730 [131] 0,160,,145,253,24,165,253,105,1,133,253,165,254,105,,133,254
  142. 735 [131] 201,68,208,233,169,4,133,252,169,40,133,251,169,63,133,254,169
  143. 740 [131] 255,133,253,160,,177,251,201,42,208,30,24,165,249,105,1,133
  144. 745 [131] 249,165,250,105,,133,250,24,162,0,188,235,56,177,253,105,1,145
  145. 750 [131] 253,232,224,8,208,242,24,165,253,105,1,133,253,165,254,105,
  146. 755 [131] 133,254,24,165,251,105,1,133,251,165,252,105,,133,252,201,7,208
  147. 760 [131] 188,165,251,201,192,208,182,234
  148. 765 [131] 169,64,133,254,169,78,133,253,169,,160,,145,253,200,145,253,24
  149. 770 [131] 165,253,105,40,133,253,165,254,105,,133,254,201,68,208,230,96
  150. 775 [131] ,1,2,40,42,80,81,82
  151.