home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 11
/
011.d81
/
states
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
5KB
|
201 lines
100 rem *************************
110 rem ** **
120 rem ** states of the union **
130 rem ** **
140 rem ** bruce jaeger **
150 rem ** **
160 rem ** st. paul, minn **
170 rem ** **
180 rem *************************
190 c=0:if peek(57344)=133 then c=1
200 rem 0=vic, 1=64
210 if c=1 then 250
220 poke 36879,8
230 poke 36878,0
240 goto 270
250 poke 53280,0:poke 53281,0
260 poke 54272+24,8
270 s6=54272:sv=36876
280 hc$=chr$(147)
290 uc$=chr$(142)+chr$(8)
300 rv$=chr$(18)
310 ro$=chr$(146)
320 wh$=chr$(5)
330 gr$=chr$(153)
340 if c=0 then gr$=chr$(30)
350 rd$=chr$(150)
360 if c=0 then rd$=chr$(28)
370 x=rnd(-ti)
380 gosub 1430: rem read data
390 print hc$ "press:"
400 print:print "q for quiz,"
410 print:print "t for tutor,"
420 print:print "e for end."
430 poke 198,0:wait 198,1:geta$
440 if a$<>"t"anda$<>"q"anda$<>"e"then 430
450 if a$="e" then printchr$(9):goto63000
460 if a$="q" then 650
470 rem *** tutorial section ***
480 print hc$
490 input "name of state";s$
500 gosub 1060 : rem check spelling
510 print hc$ rv$ s$(x) " (" pc$(x) ")" ro$ " touches:"
520 print
530 if len (t$(x))=0 then print "no other states!":goto 590
540 for y= 1 to len(t$(x))
550 z$=mid$(t$(x),y,1)
560 z=asc(z$)
570 print s$(z)
580 next y
590 print:print
600 print rv$ "another?" ro$ " (y/n)"
610 poke 198,0:wait 198,1:geta$
620 if a$<>"y" then 390
630 goto 480
640 rem *** quiz section ***
650 s=int(rnd(1)*51)+1
660 if s=2 or s=11 then 650
670 qs$=s$(s):qc$=pc$(s)
680 l=len(t$(s)):ng=0
690 print hc$ rv$ qs$ ro$
700 print:print "touches"len(t$(s))"states"
710 print:print "they are:"
720 qt$=left$("========",l)
730 if ng=l then 950:rem all states
740 print:s$=""
750 input "state:";s$:ifs$="end"then390
760 if s$=""then 650:rem new state
770 if s$=qs$ or s$=qc$ then printrv$ "silly!":goto 740
780 gosub 1060 :rem check spelling
790 sg=x:sg$=chr$(x)
800 for y= 1 to l
810 if mid$(qt$,y,1)<>sg$then next y
820 if y>l then 860
830 print "you already guessed"
840 print rv$ s$(asc(sg$)) "!"
850 goto 730
860 for y= 1 to l
870 if mid$(t$(s),y,1)<>sg$ then next y
880 if y>l then 920
890 print rv$ gr$ "correct!" wh$
900 qt$=left$(qt$,ng)+sg$+left$("========",l-ng-1)
910 ng=ng+1:goto 730
920 print rv$ rd$ "incorrect!" wh$
930 gosub 1210
940 goto 740
950 print
960 print rv$ gr$ "excellent!"
970 print "you've guessed all" l
980 print "states that touch"
990 print qs$ "!" wh$
1000 print:print
1010 print rv$ "another?" ro$ " (y/n)"
1020 poke 198,0:wait 198,1:geta$
1030 if a$<>"y" then 390
1040 goto 650
1050 rem check state name
1060 if len(s$)<>2 then 1110
1070 for x= 1 to 51
1080 if s$<>pc$(x) then next x
1090 if x<=51 then return
1100 goto 1140
1110 for x= 1 to 51
1120 if s$<>s$(x) then next x
1130 if x<=51 then return
1140 print
1150 print rd$ rv$ "no such state!" ro$
1160 print wh$"(check your spelling!)"
1170 print
1180 input "name of state";s$
1190 goto 1060
1200 rem misses
1210 if c=0 then 1330 :rem vic
1220 for q= 0 to 24:poke s6+q,0:next
1230 poke s6+24,8
1240 poke s6+5,192:poke s6+6,250
1250 for q= 120 to 80 step-3
1260 poke s6+1,q:poke s6+4,17
1270 for de= 1 to 4:next de,q
1280 poke s6+24,15:poke s6+1,15
1290 poke s6+4,128
1300 for vo= 15 to 0 step-1
1310 for de= 1 to 10:next de
1320 poke s6+24,vo:next:return
1330 poke sv+2,10
1340 for vo= 250 to 220 step-1
1350 poke sv,vo
1360 for de= 1 to 4:next de,vo
1370 poke sv,0:poke sv+1,200
1380 for vo= 15 to 0 step-.05
1390 poke sv+2,vo:next
1400 poke sv+1,0:return
1410 return
1420 rem *** read state data ***
1430 print hc$ uc$ rv$ wh$ "states"
1440 print:print"reading data..."
1450 dim s$(51),t$(51),pc$(51)
1460 for x= 1 to 51
1470 read pc$(x),s$(x)
1480 read n : if n=0 then 1530
1490 for y= 1 to n
1500 read z
1510 t$(x)=t$(x)+chr$(z)
1520 next y
1530 next x
1540 return
1550 rem *** state data ***
1560 data al,alabama,4,24,42,10,9
1570 data ak,alaska,0
1580 data az,arizona,5,5,28,44,6,31
1590 data ar,arkansas,6,43,36,25,42,24,18
1600 data ca,california,3,37,28,3
1610 data co,colorado,7,3,44,50,27,16,36,31
1620 data ct,connecticut,3,32,21,39
1630 data de,delaware,3,20,38,30
1640 data fl,florida,2,1,10
1650 data ga,georgia,5,1,42,33,40,9
1660 data hi,hawaii,0
1670 data id,idaho,6,37,47,26,50,44,28
1680 data il,illinois,5,25,15,49,14,17
1690 data in,indiana,4,13,22,35,17
1700 data ia,iowa,6,27,41,23,49,13,25
1710 dataks,kansas,4,6,27,25,36
1720 dataky,kentucky,7,25,13,14,35,48,46,42
1730 datala,louisiana,3,43,4,24
1740 datame,maine,1,29
1750 datamd,maryland,5,48,38,8,46,51
1760 datama,massachusetts,5,32,45,29,7,39
1770 datami,michigan,3,49,14,35
1780 datamn,minnesota,4,41,34,49,15
1790 datams,mississippi,4,18,4,42,1
1800 datamo,missouri,8,36,16,27,15,13,17,42,4
1810 datamt,montana,4,12,34,41,50
1820 datane,nebraska,6,6,50,41,15,25,16
1830 datanv,nevada,5,5,37,12,44,3
1840 datanh,new hampshire,3,45,19,21
1850 datanj,new jersey,3,38,32,8
1860 datanm,new mexico,5,3,44,6,36,43
1870 datany,new york,5,45,21,7,30,38
1880 datanc,north carolina,4,42,46,40,10
1890 datand,north dakota,3,26,23,41
1900 dataoh,ohio,5,14,22,38,48,17
1910 dataok,oklahoma,6,31,6,16,25,4,43
1920 dataor,oregon,4,5,47,12,28
1930 datapa,pennsylvania,6,35,32,30,8,20,48
1940 datari,rhode island,2,7,21
1950 datasc,south carolina,2,10,33
1960 datasd,south dakota,6,50,26,23,34,15,27
1970 datatn,tennessee,8,4,25,17,46,33,10,1,24
1980 datatx,texas,4,31,36,4,18
1990 dataut,utah,6,28,12,50,6,31,3
2000 datavt,vermont,3,29,21,32
2010 datava,virginia,6,17,48,20,33,42,51
2020 datawa,washington,2,37,12
2030 data wv,west virginia,5,35,17,38,20,46
2040 datawi,wisconsin,4,23,15,22,13
2050 datawy,wyoming,6,12,26,41,27,6,44
2060 datadc,district of columbia,2,20,46
63000 rem return to l.s.
63010 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
63020 poke631,13:poke632,13:poke198,2:end