home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 99 / 099.d81 / deal (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1992-01-01  |  6.7 KB  |  224 lines

  1. 3 poke56,56:poke55,0:clr
  2. 5 dv=peek(186):ifdv<8thendv=8
  3. 10 te=4:ba=0:bo=0:print"[147]"
  4. 20 poke646,te:poke53281,ba:poke53280,bo
  5. 30 gosub60000
  6. 40 sys57812"i-menu $c000",dv,0:poke780,0:poke781,0:poke782,192:sys65493
  7. 45 sys57812"deal font",dv,0:poke780,0:poke781,0:poke782,56:sys65493
  8. 49 rem first menu
  9. 50 fori=1to4:readfm$(i):next
  10. 52 for i=1to4:readb$(i):next
  11. 54 fori=1to2:readc$(i):next
  12. 55 p$="    press any key to continue"
  13. 56 te=4:poke646,te:bb$="[209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209]"
  14. 57 print"[147]"chr$(142)"":poke53272,31:for x=1to2:printbb$:next
  15. 58 for x=1to19:print"[209][209]                                  [209][209]":next
  16. 59 printbb$:printleft$(bb$,39);
  17. 60 sys49152,4,10,8,68,3,1,fm$(1),fm$(2),fm$(3),fm$(4):geta$:a=val(a$)
  18. 70 on a goto5035,99,700,6000
  19. 80 data" read it "," try the game "," simulation "," return to loadstar "
  20. 99 g=1:ke(2)=0:tr(2)=0:ke(1)=0:tr(1)=0
  21. 100 pr=int(rnd(1)*3)+1
  22. 105 forw=1to3:d(w)=0:next
  23. 110 d(pr)=1
  24. 111 print"[147]":te=10:poke646,te
  25. 112 printbb$
  26. 113 forx=1to21:print"[209]                                    [209]":nextx
  27. 114 printbb$""
  28. 115 poke214,3:poke211,28:sys58732:print"game #";g
  29. 120 sys49152,68,4,3,74,3,1,b$(1),b$(2),b$(3),b$(4):getch
  30. 130 data "  door  #1  ","  door  #2  ","  door  #3  ","    quit    "
  31. 135 if ch=4 then500
  32. 140 if pr=ch then goto190
  33. 150 if pr<>1 and ch<>1 then el=1
  34. 160 if pr<>2 and ch<>2 then el=2
  35. 170 if pr<>3 and ch<>3 then el=3
  36. 180 goto 240
  37. 190 n=int(rnd(1)*2)+1
  38. 200 if n=1 then el=pr+1
  39. 210 if el=4then el=1
  40. 220 if n=2 then el=pr-1
  41. 230 if el=0 then el=3
  42. 240 if ch<>1and el<>1thenl=1
  43. 250 if ch<>2and el<>2thenl=2
  44. 260 if ch<>3and el<>3thenl=3
  45. 270 poke214,12:poke211,4:sys58732
  46. 280 print"the prize is not behind door #";el
  47. 290 print:print"[150][209]   do you want to keep door #";ch
  48. 300 print:print"[150][209]   or trade for door #";l;"[150]?"
  49. 320 data "  keep  ","  trade  "
  50. 330 sys49152,66,25,6,74,3,1,c$(1),c$(2):getdr
  51. 332 if dr=4 then 510
  52. 333 ifdr=2thench=l
  53. 335 if dr=1thenke(1)=ke(1)+1
  54. 340 if dr=2 then tr(1)=tr(1)+1
  55. 350 d(pr)=1:ifd=2thench=l
  56. 360 if dr=1 then ke(2)=ke(2)+d(ch)
  57. 370 ifdr=2thentr(2)=tr(2)+d(ch)
  58. 380 poke214,18:poke211,14:sys58732
  59. 400 if d(ch)=1 thenprint"  you win!  ":gosub3000
  60. 410 if d(ch)=0 thenprint"  you lost! ":gosub4000
  61. 420 print:print"[150][209]   the prize was behind door #";pr
  62. 430 g=g+1
  63. 440 foru=1to700:next:  print"[147]": goto 100
  64. 500 rem analysis
  65. 510 print"[147]"
  66. 515 if ke(1)=0then600
  67. 520 poke214,3:poke211,10:sys58732
  68. 530 print"you kept";ke(1);"[150]time";:ifke(1)<>1thenprint"s"
  69. 535 ifke(1)=1thenprint
  70. 540 print:printtab(7)"and won";ke(2);"[150]of those times"
  71. 550 printtab(4)"for a winning percentage of";int(((ke(2)+.001)/ke(1))*100);"[157]%"
  72. 555 if tr(1)=0then650
  73. 560 print:printtab(10) "[150]you traded";tr(1);"[150]time";:iftr(1)<>1thenprint"s"
  74. 565 iftr(1)=1thenprint
  75. 570 print:printtab(7)"and won";tr(2);"[150]of those times"
  76. 580 printtab(4)"for a winning percentage of";int(((tr(2)+.001)/tr(1))*100);"[157]%"
  77. 590 print:print:print:printtab(7)"[150]would you like to continue?"
  78. 595 e$=" yes ":f$=" no "
  79. 597 sys49152,66,18,19,74,3,1,e$,f$:geth
  80. 598 on h goto 100,56
  81. 600 print:print:printtab(2)"[150]you never stayed on your first choice":goto555
  82. 650 print:printtab(10)"[150]you never traded":goto590
  83. 700 sa=0:sb=0
  84. 705 for l=1to100
  85. 710 rem set value of doors
  86. 720 x=int(rnd(1)*3)+1
  87. 730 foru=1to3:d(u)=0:nextu
  88. 740 d(x)=1
  89. 750 rem contestants choose one door
  90. 760 y=int(rnd(1)*3)+1
  91. 770 ca=y:cb=y
  92. 780 rem eliminate one door
  93. 790 if x=ythen828
  94. 800 ifx<>1andy<>1thenz=1:goto900
  95. 810 ifx<>2andy<>2thenz=2:goto900
  96. 820 ifx<>3andy<>3thenz=3:goto900
  97. 828 n=int(rnd(1)*2)+1
  98. 830 if n=1thenz=x+1
  99. 840 ifz=4thenz=1:goto900
  100. 850 ifn=2thenz=x-1
  101. 860 ifz=0thenz=3
  102. 890 rem contestant b switches doors
  103. 900 ifz<>1andy<>1then a=1
  104. 910 ifz<>2andy<>2then a=2
  105. 920 ifz<>3andy<>3then a=3
  106. 930 cb=a
  107. 940 rem scores
  108. 950 sa=sa+d(y)
  109. 960 sb=sb+d(a)
  110. 970 poke214,4:poke211,3:sys58732
  111. 975 te=10:poke646,te
  112. 980 print"contestants picked door #";y
  113. 990 print:printtab(3)"[150]the prize is not behind door #";z
  114. 1000 print:printtab(3)"[150]contestant b trades for door #"; a
  115. 1010 print:printtab(3)"[150]the prize was behind door #";x
  116. 1020 if d(y)=1 thenw$="a"
  117. 1030 if d(a)=1 thenw$="b"
  118. 1040 print:printtab(3)"[150]contestant ";w$;"[150] wins game #";l
  119. 1050 print:print:printtab(3)"[150]contestant a        [150]contestant b"
  120. 1060 print:printtab(5)"[150](keeps)             (trades)"
  121. 1070 print:printtab(4)"score:";sa;"[150]          score:";sb
  122. 1080 forg=1to10:nextg:next
  123. 1090 poke214,21:poke211,0:sys58732
  124. 1099 gosub3000
  125. 1100 printp$
  126. 1110 getv$:ifv$=""then1110
  127. 1120 goto56
  128. 3000 s=54272:h=24:a=0
  129. 3010 pokes+5,20:pokes+6,8:pokes+24,15
  130. 3020 pokes+1,h:pokes,0
  131. 3030 pokes+4,17:fort=0to25:next
  132. 3040 pokes+4,16
  133. 3050 a=a+1:ifa>15thenreturn
  134. 3060 ifh=24thenh=15:goto3020
  135. 3070 ifh=15thenh=24:goto3020
  136. 3080 return
  137. 4000 s=54272:fori=stos+24:pokei,0:next
  138. 4010 pokes+5,27:pokes+6,73
  139. 4020 p=1650:pokes+24,15:pokes+4,33
  140. 4030 pokes+1,int(p/256):pokes,pand255
  141. 4040 p=p-50:ifp>1000then4030
  142. 4050 pokes+4,32:forp=1to1000:next
  143. 4060 return
  144. 5000 print"[147]"
  145. 5005 te=4:poke646,te
  146. 5010 printbb$
  147. 5020 forx=1to22:print"[209]                                    [209]":nextx
  148. 5030 printbb$""
  149. 5031 te=10:poke646,10
  150. 5032 return
  151. 5035 gosub5000
  152. 5040 te=10:poke646,10
  153. 5050 poke214,3:poke211,2:sys58732
  154. 5060 print"'play the game' is your chance to"
  155. 5070 printtab(2)"test your solution to the"
  156. 5080 printtab(2)"statistical question. the first"
  157. 5090 printtab(2)"menu gives you a choice of the"
  158. 5100 printtab(2)"three doors.  use the crsr keys"
  159. 5105 printtab(2)"and return to select.  then the"
  160. 5110 printtab(2)"the computer will reveal one"
  161. 5120 printtab(2)"of the other doors, and give you"
  162. 5130 printtab(2)"the next option: keep your first"
  163. 5140 printtab(2)"choice or trade for the other"
  164. 5150 printtab(2)"door.  when you've made your
  165. 5160 [153][163]2)"choice, it will reveal whether
  166. 5170 printtab(2)"you've won or lost, and show where
  167. 5180 [153][163]2)"the prize was.  a counter in the
  168. 5190 printtab(2)"top right of the screen will let
  169. 5200 [153][163]2)"you know how many games you've
  170. 5205 printtab(2)"played.
  171. 5210 [151]214,22:[151]211,0:[158]58732:[153]p$
  172. 5215 [161]a$:[139]a$[178]""[167]5215
  173. 5220 [141]5000
  174. 5230 [151]214,4:[151]211,2:[158]58732
  175. 5240 [153]"when you select quit, you'll see"
  176. 5250 [153][163]2)"how many times you kept your first"
  177. 5260 [153][163]2)"choice, how many of those times
  178. 5270 printtab(2)"you won, and what your percentage
  179. 5280 [153][163]2)"was -- and the same statistics for
  180. 5290 printtab(2)"the times you traded.  you may
  181. 5300 [153][163]2)"then choose to play some more
  182. 5310 printtab(2)"rounds or return to the main menu.
  183. 5320 [153][163]2)"remember that it is possible to
  184. 5330 printtab(2)"have a lucky streak.  according to
  185. 5340 [153][163]2)"my mathematically inclined husband"
  186. 5350 [153][163]2)"(and my own experimentation), it's"
  187. 5360 [153][163]2)"necessary to play about 30 games"
  188. 5370 [153][163]2)"each way before you'll begin to
  189. 5380 printtab(2)"get fairly consistent results."
  190. 5390 poke214,22:poke211,0:sys58732:printp$
  191. 5400 geta$:ifa$=""then5400
  192. 5410 gosub5000
  193. 5420 poke214,4:poke211,2:sys58732
  194. 5430 print"the 'simulation' program quickly"
  195. 5440 printtab(2)"tests the problem 100 times. two"
  196. 5450 printtab(2)"contestants 'play' simultaneously."
  197. 5460 printtab(2)"they choose the same door for
  198. 5470 [153][163]2)"their first choice.  after the
  199. 5480 printtab(2)"computer reveals a booby-prize
  200. 5490 [153][163]2)"door, contestant a always keeps
  201. 5500 printtab(2)"the original choice; contestant b"
  202. 5510 printtab(2)"always switches."
  203. 5560 poke214,22:poke211,0:sys58732:printp$
  204. 5570 geta$:ifa$=""then5570
  205. 5580 goto56
  206. 6000 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
  207. 6010 print"[147][144][159]";:poke53272,21
  208. 6020 ifer<>63thenend
  209. 6030 print"[144]load"chr$(34)"hello connect"chr$(34)",8"
  210. 6040 print"run"
  211. 6050 poke631,13:poke632,13:poke198,2:end
  212. 10000 open15,8,15,"s0:deal":close15:save"deal",8:end
  213. 60000 print"[147]":z$=" [152]                                      ":poke214,10:print
  214. 60010 print" [155][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]":fori=0to11:printz$:next
  215. 60020 print" [151][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][152]"
  216. 60030 z$(0)="[204] [197] [212] ' [211]   [205] [193] [203] [197]   [193]   [196] [197] [193] [204]":z$(1)="by [195]ayre [211]cott
  217. 60040 z$(2)[178]"(NULL)1.0 (len) 1992 by (NULL)oftdisk, right$nc."[170][199](13)
  218. 60050 z$(3)[178]"(NULL)his program is the copyrighted work
  219. 60060 z$(4)="of [211][207][198][212][196][201][211][203] [208][213][194][204][201][211][200][201][206][199].  [201]t is not"
  220. 60070 z$(5)="shareware or in the public domain."
  221. 60080 z$(6)="[210]eport illegal distribution of":z$(7)="this program by calling"
  222. 60090 z$(8)="1-800-831-2694 or 1-318-221-8718.":poke214,12:print
  223. 60100 fori=0to8:printtab(20-(len(z$(i))/2))""z$(i):next:return
  224.