home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 11 / 011.d81 / states (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  5KB  |  201 lines

  1. 100 rem *************************
  2. 110 rem **                     **
  3. 120 rem ** states of the union **
  4. 130 rem **                     **
  5. 140 rem **    bruce jaeger     **
  6. 150 rem **                     **
  7. 160 rem **   st. paul, minn    **
  8. 170 rem **                     **
  9. 180 rem *************************
  10. 190 c=0:if peek(57344)=133 then c=1
  11. 200 rem 0=vic, 1=64
  12. 210 if c=1 then 250
  13. 220 poke 36879,8
  14. 230 poke 36878,0
  15. 240 goto 270
  16. 250 poke 53280,0:poke 53281,0
  17. 260 poke 54272+24,8
  18. 270 s6=54272:sv=36876
  19. 280 hc$=chr$(147)
  20. 290 uc$=chr$(142)+chr$(8)
  21. 300 rv$=chr$(18)
  22. 310 ro$=chr$(146)
  23. 320 wh$=chr$(5)
  24. 330 gr$=chr$(153)
  25. 340 if c=0 then gr$=chr$(30)
  26. 350 rd$=chr$(150)
  27. 360 if c=0 then rd$=chr$(28)
  28. 370 x=rnd(-ti)
  29. 380 gosub 1430: rem read data
  30. 390 print hc$ "press:"
  31. 400 print:print "q for quiz,"
  32. 410 print:print "t for tutor,"
  33. 420 print:print "e for end."
  34. 430 poke 198,0:wait 198,1:geta$
  35. 440 if a$<>"t"anda$<>"q"anda$<>"e"then 430
  36. 450 if a$="e" then printchr$(9):goto63000
  37. 460 if a$="q" then 650
  38. 470 rem *** tutorial section ***
  39. 480 print hc$
  40. 490 input "name of state";s$
  41. 500 gosub 1060   : rem check spelling
  42. 510 print hc$ rv$ s$(x) " (" pc$(x) ")" ro$ " touches:"
  43. 520 print
  44. 530 if len (t$(x))=0 then print "no other states!":goto 590
  45. 540 for y= 1 to len(t$(x))
  46. 550 z$=mid$(t$(x),y,1)
  47. 560 z=asc(z$)
  48. 570 print s$(z)
  49. 580 next y
  50. 590 print:print
  51. 600 print rv$ "another?" ro$ " (y/n)"
  52. 610 poke 198,0:wait 198,1:geta$
  53. 620 if a$<>"y" then 390
  54. 630 goto 480
  55. 640 rem *** quiz section ***
  56. 650 s=int(rnd(1)*51)+1
  57. 660 if s=2 or s=11 then 650
  58. 670 qs$=s$(s):qc$=pc$(s)
  59. 680 l=len(t$(s)):ng=0
  60. 690 print hc$ rv$ qs$ ro$
  61. 700 print:print "touches"len(t$(s))"states"
  62. 710 print:print "they are:"
  63. 720 qt$=left$("========",l)
  64. 730 if ng=l then 950:rem all states
  65. 740 print:s$=""
  66. 750 input "state:";s$:ifs$="end"then390
  67. 760 if s$=""then 650:rem new state
  68. 770 if s$=qs$ or s$=qc$ then printrv$ "silly!":goto 740
  69. 780 gosub 1060  :rem check spelling
  70. 790 sg=x:sg$=chr$(x)
  71. 800 for y= 1 to l
  72. 810 if mid$(qt$,y,1)<>sg$then next y
  73. 820 if y>l then 860
  74. 830 print "you already guessed"
  75. 840 print rv$ s$(asc(sg$)) "!"
  76. 850 goto 730
  77. 860 for y= 1 to l
  78. 870 if mid$(t$(s),y,1)<>sg$ then next y
  79. 880 if y>l then 920
  80. 890 print rv$ gr$ "correct!" wh$
  81. 900 qt$=left$(qt$,ng)+sg$+left$("========",l-ng-1)
  82. 910 ng=ng+1:goto 730
  83. 920 print rv$ rd$ "incorrect!" wh$
  84. 930 gosub 1210
  85. 940 goto 740
  86. 950 print
  87. 960 print rv$ gr$ "excellent!"
  88. 970 print "you've guessed all" l
  89. 980 print "states that touch"
  90. 990 print qs$ "!" wh$
  91. 1000 print:print
  92. 1010 print rv$ "another?" ro$ " (y/n)"
  93. 1020 poke 198,0:wait 198,1:geta$
  94. 1030 if a$<>"y" then 390
  95. 1040 goto 650
  96. 1050 rem check state name
  97. 1060 if len(s$)<>2 then 1110
  98. 1070 for x= 1 to 51
  99. 1080 if s$<>pc$(x) then next x
  100. 1090 if x<=51 then return
  101. 1100 goto 1140
  102. 1110 for x= 1 to 51
  103. 1120 if s$<>s$(x) then next x
  104. 1130 if x<=51 then return
  105. 1140 print
  106. 1150 print rd$ rv$ "no such state!" ro$
  107. 1160 print wh$"(check your spelling!)"
  108. 1170 print
  109. 1180 input "name of state";s$
  110. 1190 goto 1060
  111. 1200 rem misses
  112. 1210 if c=0 then 1330  :rem vic
  113. 1220 for q= 0 to 24:poke s6+q,0:next
  114. 1230 poke s6+24,8
  115. 1240 poke s6+5,192:poke s6+6,250
  116. 1250 for q= 120 to 80 step-3
  117. 1260 poke s6+1,q:poke s6+4,17
  118. 1270 for de= 1 to 4:next de,q
  119. 1280 poke s6+24,15:poke s6+1,15
  120. 1290 poke s6+4,128
  121. 1300 for vo= 15 to 0 step-1
  122. 1310 for de= 1 to 10:next de
  123. 1320 poke s6+24,vo:next:return
  124. 1330 poke sv+2,10
  125. 1340 for vo= 250 to 220 step-1
  126. 1350 poke sv,vo
  127. 1360 for de= 1 to 4:next de,vo
  128. 1370 poke sv,0:poke sv+1,200
  129. 1380 for vo= 15 to 0 step-.05
  130. 1390 poke sv+2,vo:next
  131. 1400 poke sv+1,0:return
  132. 1410 return
  133. 1420 rem *** read state data ***
  134. 1430 print hc$ uc$ rv$ wh$ "states"
  135. 1440 print:print"reading data..."
  136. 1450 dim s$(51),t$(51),pc$(51)
  137. 1460 for x= 1 to 51
  138. 1470 read pc$(x),s$(x)
  139. 1480 read n : if n=0 then 1530
  140. 1490 for y= 1 to n
  141. 1500 read z
  142. 1510 t$(x)=t$(x)+chr$(z)
  143. 1520 next y
  144. 1530 next x
  145. 1540 return
  146. 1550 rem *** state data ***
  147. 1560 data al,alabama,4,24,42,10,9
  148. 1570 data ak,alaska,0
  149. 1580 data az,arizona,5,5,28,44,6,31
  150. 1590 data ar,arkansas,6,43,36,25,42,24,18
  151. 1600 data ca,california,3,37,28,3
  152. 1610 data co,colorado,7,3,44,50,27,16,36,31
  153. 1620 data ct,connecticut,3,32,21,39
  154. 1630 data de,delaware,3,20,38,30
  155. 1640 data fl,florida,2,1,10
  156. 1650 data ga,georgia,5,1,42,33,40,9
  157. 1660 data hi,hawaii,0
  158. 1670 data id,idaho,6,37,47,26,50,44,28
  159. 1680 data il,illinois,5,25,15,49,14,17
  160. 1690 data in,indiana,4,13,22,35,17
  161. 1700 data ia,iowa,6,27,41,23,49,13,25
  162. 1710 dataks,kansas,4,6,27,25,36
  163. 1720 dataky,kentucky,7,25,13,14,35,48,46,42
  164. 1730 datala,louisiana,3,43,4,24
  165. 1740 datame,maine,1,29
  166. 1750 datamd,maryland,5,48,38,8,46,51
  167. 1760 datama,massachusetts,5,32,45,29,7,39
  168. 1770 datami,michigan,3,49,14,35
  169. 1780 datamn,minnesota,4,41,34,49,15
  170. 1790 datams,mississippi,4,18,4,42,1
  171. 1800 datamo,missouri,8,36,16,27,15,13,17,42,4
  172. 1810 datamt,montana,4,12,34,41,50
  173. 1820 datane,nebraska,6,6,50,41,15,25,16
  174. 1830 datanv,nevada,5,5,37,12,44,3
  175. 1840 datanh,new hampshire,3,45,19,21
  176. 1850 datanj,new jersey,3,38,32,8
  177. 1860 datanm,new mexico,5,3,44,6,36,43
  178. 1870 datany,new york,5,45,21,7,30,38
  179. 1880 datanc,north carolina,4,42,46,40,10
  180. 1890 datand,north dakota,3,26,23,41
  181. 1900 dataoh,ohio,5,14,22,38,48,17
  182. 1910 dataok,oklahoma,6,31,6,16,25,4,43
  183. 1920 dataor,oregon,4,5,47,12,28
  184. 1930 datapa,pennsylvania,6,35,32,30,8,20,48
  185. 1940 datari,rhode island,2,7,21
  186. 1950 datasc,south carolina,2,10,33
  187. 1960 datasd,south dakota,6,50,26,23,34,15,27
  188. 1970 datatn,tennessee,8,4,25,17,46,33,10,1,24
  189. 1980 datatx,texas,4,31,36,4,18
  190. 1990 dataut,utah,6,28,12,50,6,31,3
  191. 2000 datavt,vermont,3,29,21,32
  192. 2010 datava,virginia,6,17,48,20,33,42,51
  193. 2020 datawa,washington,2,37,12
  194. 2030 data wv,west virginia,5,35,17,38,20,46
  195. 2040 datawi,wisconsin,4,23,15,22,13
  196. 2050 datawy,wyoming,6,12,26,41,27,6,44
  197. 2060 datadc,district of columbia,2,20,46
  198. 63000 rem    return to l.s.
  199. 63010 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
  200. 63020 poke631,13:poke632,13:poke198,2:end
  201.