home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 6 / 006.d81 / election night (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1984-01-01  |  8.0 KB  |  277 lines

  1. 10 rem *** election night           ***
  2. 20 rem *** copyright 1984           ***
  3. 30 rem *** by john beltrami         ***
  4. 31 rem *** translated by donna woody***
  5. 35 s=65520:poke783,peek(783)and254
  6. 37 poke53280,1:poke53281,7:printchr$(144):poke53272,23:printchr$(8)
  7. 40 printchr$(147):poke781,3:poke782,13:syss:print"[197][204][197][195][212][201][207][206] [206][201][199][200][212]"
  8. 41 poke781,7:poke782,19:syss:print"by"
  9. 42 poke781,9:poke782,13:syss:print"[202]ohn [194]eltrami"
  10. 43 poke781,15:poke782,4:syss:print"[212]ranslated for the [195]ommodore by"
  11. 44 poke781,17:poke782,13:syss:print"[196]onna [203]. [215]oody"
  12. 50 dimv(51,3),n$(51),p$(51),e(51)
  13. 60 gosub2180:rem *** initialize   ***
  14. 70 gosub1330:rem *** introduction ***
  15. 80 gosub1140:rem *** main menu    ***
  16. 90 rem *** results                  ***
  17. 100 printchr$(147)
  18. 120 poke781,2:poke782,10:syss:print"[210][197][211][213][204][212][211] [205][197][206][213]"
  19. 140 poke781,5:poke782,5:syss:print"1 - [211]tate [214]oting [210]esults"
  20. 150 poke781,6:poke782,5:syss:print"    (data entry)"
  21. 160 poke781,8:poke782,5:syss:print"2 - [206]ational [208]icture"
  22. 170 poke781,9:poke782,5:syss:print"    (results)"
  23. 180 poke781,11:poke782,5:syss:print"3 - [210]eturn to [205]ain [205]enu"
  24. 190 poke781,15:poke782,5:syss:print"[217]our choice?";:poke198,0:wait198,1:gety$
  25. 200 y=val(y$):ify<1ory>3thengoto190
  26. 210 ify=3thengoto250
  27. 220 ify=2thengosub480:goto100:rem *** national ***
  28. 230 gosub260:rem *** state ***
  29. 240 goto100
  30. 250 return
  31. 260 rem *** state menu              ***
  32. 270 printchr$(147)
  33. 280 fori=1to20
  34. 290 h1=0:h2=13:h3=26
  35. 300 i$=str$(i):ifi<10theni$=" "+i$
  36. 310 i$=i$+"-"+n$(i)
  37. 320 printi$
  38. 330 j=i+20:i$=str$(j)
  39. 340 i$=i$+"-"+n$(j)
  40. 350 poke781,i:poke782,h2:syss:printi$
  41. 360 ifi>11thengoto400
  42. 370 j=i+40:i$=str$(j)
  43. 380 i$=i$+"-"+n$(j)
  44. 390 poke781,i:poke782,h3:syss:printi$
  45. 400 nexti
  46. 410 poke781,22:poke782,0:syss:print"[197]nter zero[144] to exit or number of a state[144]"
  47. 420 goto440
  48. 430 poke781,22:poke782,0:syss:print"           [197]nter <0> to exit           "
  49. 440 poke781,23:poke782,10:syss:input"[217]our choice";y$
  50. 450 y=val(y$):ify>51thengoto430
  51. 460 ify>0thengosub850:goto270:rem *** state ***
  52. 470 return
  53. 480 rem *** national report         ***
  54. 490 printchr$(147)
  55. 510 poke781,2:poke782,10:syss:print"[206][193][212][201][207][206][193][204] [210][197][211][213][204][212][211]"
  56. 530 tt(1)=0:tt(2)=0:tt(3)=0
  57. 540 te(1)=0:te(2)=0:te(3)=0
  58. 550 s(1)=0:s(2)=0:s(3)=0
  59. 560 fori=1to51
  60. 570 tt(1)=tt(1)+v(i,1)
  61. 580 tt(2)=tt(2)+v(i,2)
  62. 590 tt(3)=tt(3)+v(i,3)
  63. 600 if(v(i,1)>v(i,2))and(v(i,1)>v(i,3))thente(1)=te(1)+e(i):s(1)=s(1)+1
  64. 610 if(v(i,2)>v(i,1))and(v(i,2)>v(i,3))thente(2)=te(2)+e(i):s(2)=s(2)+1
  65. 620 if(v(i,3)>v(i,1))and(v(i,3)>v(i,2))thente(3)=te(3)+e(i):s(3)=s(3)+1
  66. 630 nexti
  67. 640 poke781,4:poke782,3:syss:print"270 electoral votes needed to win"
  68. 660 poke781,6:poke782,12:syss:print"[197][204][197][195][212][207][210][193][204]      [195][193][210][210][201][197][196]"
  69. 670 poke781,7:poke782,14:syss:print"[214][207][212][197][211]         [211][212][193][212][197][211]"
  70. 680 flag=1:z=te(1):gosub2430:flag=0
  71. 690 poke781,9:poke782,1:syss:print"[196]emocratic:   ";z$
  72. 695 flag=1:z=s(1):gosub2430:flag=0
  73. 700 poke781,9:poke782,29:syss:printz$
  74. 705 flag=1:z=te(2):gosub2430:flag=0
  75. 710 poke781,11:poke782,1:syss:print"[210]epublican:   ";z$
  76. 715 flag=1:z=s(2):gosub2430:flag=0
  77. 720 poke781,11:poke782,29:syss:printz$
  78. 725 flag=1:z=te(3):gosub2430:flag=0
  79. 730 poke781,13:poke782,1:syss:print"[207]ther:        ";z$
  80. 735 flag=1:z=s(3):gosub2430:flag=0
  81. 740 poke781,13:poke782,29:syss:printz$
  82. 750 poke781,15:poke782,13:syss:print"[208][207][208][213][204][193][210] [214][207][212][197]"
  83. 760 z=tt(1):gosub2430
  84. 770 poke781,17:poke782,5:syss:print"[196]emocrats ......";z$
  85. 780 z=tt(2):gosub2430
  86. 790 poke781,18:poke782,5:syss:print"[210]epublicans ....";z$
  87. 800 z=tt(3):gosub2430
  88. 810 poke781,19:poke782,5:syss:print"[207]ther ..........";z$
  89. 820 poke781,22:poke782,5:syss:print"[210]eady to return to menu (y/n)?";
  90. 830 poke198,0:wait198,1:gety$:ify$<>"y"andy$<>"[217]"then820
  91. 840 return
  92. 850 rem *** state results           ***
  93. 860 printchr$(147)
  94. 870 poke781,1:poke782,10:syss:print"[211][212][193][212][197]: "n$(y)
  95. 880 poke781,3:poke782,10:syss:print"[197][204][197][195][212][207][210][193][204] [214][207][212][197][211]: ";e(y)
  96. 890 v1=4
  97. 900 fori=1to6
  98. 910 poke781,v1+i:poke782,1:syss:printyy$(i)
  99. 930 poke781,v1+i:poke782,6:syss:ifmid$(p$(y),i,1)="d"thenprint"[196]emocrat"
  100. 950 poke781,v1+i:poke782,6:syss:ifmid$(p$(y),i,1)="r"thenprint"[210]epublican"
  101. 970 poke781,v1+i:poke782,6:syss:ifmid$(p$(y),i,1)="o"thenprint"[207]ther"
  102. 990 nexti
  103. 1000 poke781,12:poke782,5:syss:print"[196]emocratic vote:  ";v(y,1)
  104. 1010 poke781,14:poke782,5:syss:print"[210]epublican vote:  ";v(y,2)
  105. 1020 poke781,16:poke782,5:syss:print"[207]ther party vote: ";v(y,3)
  106. 1030 poke781,18:poke782,5:syss:print"<[196]> update [196]emocratic votes"
  107. 1040 poke781,19:poke782,5:syss:print"<[210]> update [210]epublican votes"
  108. 1050 poke781,20:poke782,5:syss:print"<[207]> update other party votes"
  109. 1060 poke781,21:poke782,5:syss:print"<[216]> return to state menu (exit)"
  110. 1070 poke781,23:poke782,10:syss:print"[217]our choice?";:poke198,0:wait198,1:gety$
  111. 1080 ify$="x"ory$="[216]"thengoto1130
  112. 1090 ify$="d"ory$="[196]"thennn$="[196]emocrat":nn=1:gosub2360:goto850
  113. 1100 ify$="r"ory$="[210]"thennn$="[210]epublican":nn=2:gosub2360:goto850
  114. 1110 ify$="o"ory$="[207]"thennn$="[207]ther":nn=3:gosub2360:goto850
  115. 1120 goto1070
  116. 1130 return
  117. 1140 rem *** main menu              ***
  118. 1150 printchr$(147)
  119. 1170 poke781,5:poke782,5:syss:print"[197][204][197][195][212][201][207][206][160][206][201][199][200][212][160][205][197][206][213]"
  120. 1190 poke781,10:poke782,5:syss:print"1 - [197]lection analysis"
  121. 1200 poke781,12:poke782,5:syss:print"2 - [212]rash-can current results and"
  122. 1210 poke781,13:poke782,5:syss:print"    start fresh!"
  123. 1220 poke781,15:poke782,5:syss:print"3 - [209]uit (exit the program)"
  124. 1230 poke781,20:poke782,5:syss:print"[217]our choice?  ";:poke198,0:wait198,1:gety$
  125. 1240 y=val(y$):ify<1ory>3thengoto1230
  126. 1245 printy$
  127. 1250 ify=1thengosub90:goto1320:rem *** results ***
  128. 1260 ify=2thengoto1300
  129. 1265 print
  130. 1270 poke781,22:poke782,5:syss:print"[193]re you sure?";:poke198,0:wait198,1:gety$
  131. 1280 ify$="y"ory$="[217]"thengoto2580:rem *** end ***
  132. 1290 goto1140
  133. 1300 poke781,22:poke782,5:syss:print"[193]re you sure (y/n)?";
  134. 1310 poke198,0:wait198,1:gety$:ify$="y"ory$="[217]"thengosub2280:rem * clear totals
  135. 1320 goto1140
  136. 1330 rem *** introduction           ***
  137. 1340 printchr$(147)
  138. 1430 poke781,2:poke782,13:syss:print"[197][204][197][195][212][201][207][206]"
  139. 1440 poke781,2:poke782,22:syss:print"[206][201][199][200][212]"
  140. 1460 poke781,4:poke782,12:syss
  141. 1470 print" copyright 1984 "
  142. 1480 poke781,6:poke782,12:syss
  143. 1490 print"by [202]ohn [194]eltrami"
  144. 1500 print:print
  145. 1510 print"[212]his program allows you to follow the"
  146. 1520 print
  147. 1530 print"[208]residential election and chart the"
  148. 1540 print
  149. 1550 print"results as they become known.  [212]he"
  150. 1560 print
  151. 1570 print"results of the last six elections have"
  152. 1580 print
  153. 1590 print"been included so that state trends can"
  154. 1600 print
  155. 1610 print"be analyzed."
  156. 1620 print:print
  157. 1630 print
  158. 1640 poke781,23:poke782,5:syss:print"[193]re you ready to start (y/n)?";
  159. 1650 poke198,0:wait198,1:gety$:ify$<>"y"andy$<>"[217]"then1640
  160. 1651 printchr$(147):poke781,5:poke782,1:syss
  161. 1652 print:print"[208]lease remember that you can only enter"
  162. 1653 print:print"the popular vote count.  [212]he computer"
  163. 1654 print:print"will assign the electoral votes to the"
  164. 1656 print:print"candidate with the majority of the"
  165. 1657 print:print"popular votes cast in that state."
  166. 1659 print:print"270 electoral votes win!"
  167. 1660 poke781,23:poke782,5:syss:print"[210]eady to go (y/n)?";
  168. 1662 poke198,0:wait198,1:gety$:ify$<>"y"andy$<>"[217]"then1660
  169. 1665 return
  170. 1670 data"[193]labama  ","drordr",9
  171. 1680 data"[193]laska   ","rdrrrr",3
  172. 1690 data"[193]rizona  ","rrrrrr",7
  173. 1700 data"[193]rkansas ","ddordr",6
  174. 1710 data"[195]alif.   ","rddddr",47
  175. 1720 data"[195]olorado ","rdrrrr",8
  176. 1730 data"[195]onnect. ","dddrrr",8
  177. 1740 data"[196]elaware ","ddrrdr",3
  178. 1750 data"[196].[195]. [215]ash","oddddd",3
  179. 1760 data"[198]lorida  ","rdrrdr",21
  180. 1770 data"[199]eorgia  ","drordd",12
  181. 1780 data"[200]awaii   ","dddrdd",4
  182. 1790 data"[201]daho    ","rdrrrr",4
  183. 1800 data"[201]llinois ","ddrrrr",24
  184. 1810 data"[201]ndiana  ","rdrrrr",12
  185. 1820 data"[201]owa     ","rdrrrr",8
  186. 1830 data"[203]ansas   ","rdrrrr",7
  187. 1840 data"[203]entucky ","rdrrdr",9
  188. 1850 data"[204]ouisiana","drordr",10
  189. 1860 data"[205]aineiana","rddrrr",4
  190. 1870 data"[205]aryland ","dddrdr",10
  191. 1880 data"[205]ass.    ","dddddr",13
  192. 1890 data"[205]ichigan ","dddddr",20
  193. 1900 data"[205]innesota","dddrdd",10
  194. 1910 data"[205]ississi.","drordr",7
  195. 1920 data"[205]issouri ","ddrrdr",11
  196. 1930 data"[205]ontana  ","rdrrrr",4
  197. 1940 data"[206]ebraska ","rdrrrr",5
  198. 1950 data"[206]evada   ","ddrrrr",4
  199. 1960 data"[206]ew [200]amp.","rdrrrr",4
  200. 1970 data"[206] [202]ersey ","dddrrr",16
  201. 1980 data"[206] [205]exico ","ddrrrr",5
  202. 1990 data"[206]ew [217]ork ","dddrdr",36
  203. 2000 data"[206]o. [195]arol","ddrrdr",13
  204. 2010 data"[206]o [196]akota","rdrrrr",3
  205. 2020 data"[207]hio     ","rdrrdr",23
  206. 2030 data"[207]klahoma ","rdrrrr",8
  207. 2040 data"[207]regon   ","rdrrrr",7
  208. 2050 data"[208]ennsyl. ","dddrdr",25
  209. 2060 data"[210]hode [201]sl","dddrdd",4
  210. 2070 data"[211]o. [195]arol","drrrdr",8
  211. 2080 data"[211]o.[196]akota","rdrrrr",3
  212. 2090 data"[212]ennessee","rdrrdr",11
  213. 2100 data"[212]exas    ","dddrdr",29
  214. 2110 data"[213]tah     ","rdrrrr",5
  215. 2120 data"[214]ermont  ","rdrrrr",3
  216. 2130 data"[214]irginia ","rdrrrr",12
  217. 2140 data"[215]ashingtn","rddrrr",10
  218. 2150 data"[215] [214]irgini","dddrdd",6
  219. 2160 data"[215]isconsin","rdrrdr",11
  220. 2170 data"[215]yoming  ","rdrrrr",3
  221. 2180 rem *** initialize             ***
  222. 2185 sp$="                                       "
  223. 2190 fori=1to51
  224. 2200 readn$(i),p$(i),e(i)
  225. 2210 nexti
  226. 2220 yy$(1)="1960"
  227. 2230 yy$(2)="1964"
  228. 2240 yy$(3)="1968"
  229. 2250 yy$(4)="1972"
  230. 2260 yy$(5)="1976"
  231. 2270 yy$(6)="1980"
  232. 2280 tt(1)=0:tt(2)=0:tt(3)=0
  233. 2290 te(1)=0:te(2)=0:te(3)=0
  234. 2300 fori=1to51
  235. 2310 forj=1to3
  236. 2320 v(i,j)=0
  237. 2330 nextj
  238. 2340 nexti
  239. 2350 return
  240. 2360 rem *** update votes           ***
  241. 2370 poke781,17:poke782,0:syss
  242. 2375 forx=1to7:printsp$:next
  243. 2380 poke781,19:poke782,5:syss:print"[206]ew ";nn$;" vote count"
  244. 2390 poke781,23:poke782,5:syss:input"---->";u$
  245. 2400 u=val(u$)
  246. 2410 v(y,nn)=u
  247. 2420 return
  248. 2430 rem *** format numbers         ***
  249. 2440 z$="":z1=0
  250. 2450 z1$=str$(z)
  251. 2460 zz=len(z1$)
  252. 2470 ifzz>3thenz1=1
  253. 2480 ifzz>6thenz1=z1+1
  254. 2490 fori=1tozz
  255. 2500 j=zz+1-i
  256. 2510 z$=mid$(z1$,j,1)+z$
  257. 2520 ifz1>0andi=3thenz$=","+z$
  258. 2530 ifz1>1andi=6thenz$=","+z$
  259. 2540 nexti
  260. 2545 ifmid$(z$,2,1)=","thenz$=right$(z$,(len(z$)-2))
  261. 2550 zz=len(z$)
  262. 2555 ifflag=1thenifzz<3thenz$=" "+z$:goto2550
  263. 2557 ifflag=1then2570
  264. 2560 ifzz<11thenz$="."+z$:goto2550
  265. 2570 return
  266. 2580 rem *** final message          ***
  267. 2590 printchr$(147)
  268. 2630 poke781,11:poke782,10:syss
  269. 2640 print" [196]emocracy[160]"
  270. 2670 poke781,13:poke782,10:syss
  271. 2680 print"  at work [160]"
  272. 2710 poke781,15:poke782,10:syss
  273. 2720 print" [199]ood-bye!"
  274. 2730 forx=1to3000:next
  275. 2740 print"[147]load"chr$(34)"hello"chr$(34)",8":print"run"
  276. 2750 poke631,13:poke632,13:poke198,2:end
  277.