home *** CD-ROM | disk | FTP | other *** search
/ Floppy Magazine 1986 #1 / Floppy_Magazine_86-1_1986_Megasystems_Oy_fi.d64 / yatzy (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  6KB  |  296 lines

  1. 5 poke53280,0:poke53281,11:dimr$(18)
  2. 10 dim pt(4,18):dim pk(4,18):dim t$(18)
  3. 15 dimhd(6),ld(6)
  4. 16 fori=0to6:readhd(i),ld(i):next
  5. 17 data9,21,18,42,20,100,24,63,27,56,30,141,36,85
  6. 20 for i=0to18
  7. 30 read t$(i),r$(i):nexti
  8. 35 data.,.,a,ykkoset,b,kakkoset,c,kolmoset,d,neloset,e,viitoset,f,kuutoset,,,,
  9. 40 datag,pari,h,2 paria,i,3 samaa,j,4 samaa,k,p-suora,l,i-suora,m,t-kasi
  10. 45 datan,sekal.,o,yatzy,.,.
  11. 50 poke53272,23
  12. 55 print"[147]          [154]                 "
  13. 60 print"            [217][160][160][193][160][160][212][160][160][218][160][160][217]  "
  14. 70 print"                           "
  15. 80 print
  16. 90 print"          [210]isto  [200]amalainen"
  17. 100 print"             1  9  8  3   "
  18. 110 print
  19. 120 print" [212]ama on normaalin yatzy-pelin tieto-"
  20. 130 print" koneversio 1-4:lle pelaajalle."
  21. 140 print
  22. 150 print" [211]euraa ruudun ylareunaan tulevia  "
  23. 160 print" toimintaohjeita. [214]arsinaisia yatzyn"
  24. 165 print" saantoja ei tassa selviteta erikseen."
  25. 170 print" [203]one arpoo pelijarjestyksen,pitaa"
  26. 180 print" kirjanpitoa seka ohjaa pelin kulkua.":print
  27. 220 print" [205]ika on pelaajien maara";:inputpm
  28. 225 ifpm<1orpm>4then220
  29. 230 print:print" [193]nna nimet (max 5 kirj.):     "
  30. 240 for i=1topm
  31. 250 print" [208]elaaja"i;
  32. 252 input n$(i):iflen(n$(i))>5then n$(i)=left$(n$(i),5)
  33. 258 next
  34. 260 print" [203]iitos! [208]aina [210][197][212][213][210][206][146]!"
  35. 270 geta$:ifa$=""then270
  36. 280 for i=1to6
  37. 290 h1=hd(i):l1=ld(i):ke=125
  38. 300 gosub6000
  39. 310 next
  40. 400 for i=1to pm
  41. 410 x=int(rnd(1)*pm)+1
  42. 420 if n$(x)="x" then 410
  43. 430 p$(i)=n$(x):n$(x)="x"
  44. 440 nexti
  45. 600 print"[147]"
  46. 605 print"[176][192][192][192][192][192][192][192][192][178][192][192][192][192][178][192][192][192][192][178][192][192][192][192][178][192][192][192][192][174]"
  47. 610 print"[221]peli    [221]    [221]    [221]    [221]    [221] vuorossa"
  48. 620 print"[171][192][192][192][192][192][192][192][192][219][192][192][192][192][219][192][192][192][192][219][192][192][192][192][219][192][192][192][192][179]"
  49. 630 print"[221]a 1:set [221]    [221]    [221]    [221]    [221]"
  50. 640 print"[221]b 2:set [221]    [221]    [221]    [221]    [221]"
  51. 650 print"[221]c 3:set [221]    [221]    [221]    [221]    [221]"
  52. 660 print"[221]d 4:set [221]    [221]    [221]    [221]    [221]"
  53. 670 print"[221]e 5:set [221]    [221]    [221]    [221]    [221]"
  54. 680 print"[221]f 6:set [221]    [221]    [221]    [221]    [221]n o p a t"
  55. 690 print"[171][192][192][192][192][192][192][192][192][219][192][192][192][192][219][192][192][192][192][219][192][192][192][192][219][192][192][192][192][179]         "
  56. 700 print"[221]1-6 yht.[221]    [221]    [221]    [221]    [221]"
  57. 710 print"[221] hyvitys[221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221]"
  58. 720 print"[221]g pari  [221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221]        "
  59. 730 print"[221]h 2paria[221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221]        "
  60. 740 print"[221]i 3samaa[221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221] valittu"
  61. 750 print"[221]j 4samaa[221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221]  peli "
  62. 760 print"[221]k psuora[221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221]"
  63. 770 print"[221]l isuora[221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221]"
  64. 780 print"[221]m t-kasi[221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221]"
  65. 790 print"[221]n sekal.[221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221]"
  66. 800 print"[221]o yatzy [221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221][160][160][160][160][221]"
  67. 810 print"[171][192][192][192][192][192][192][192][192][219][192][192][192][192][219][192][192][192][192][219][192][192][192][192][219][192][192][192][192][179]"
  68. 820 print"[221]yhteensa[221]    [221]    [221][160][160][160][160][221][160][160][160][160][221]"
  69. 840 print"[173][192][192][192][192][192][192][192][192][177][192][192][192][192][177][192][192][192][192][177][192][192][192][192][177][192][192][192][192][189]";
  70. 850 print"";tab(10);p$(1);
  71. 860 printtab(15);p$(2);
  72. 870 printtab(20);p$(3);
  73. 880 printtab(25);p$(4)
  74. 1000 v=0
  75. 1010 v=v+1:if v>pm then v=1
  76. 1015 print"[150]";tab(31);"        "
  77. 1020 print"";tab(32);"";p$(v)
  78. 1030 h1=hd(1):l1=ld(1):ke=125:gosub6000
  79. 1040 h1=hd(v+1):l1=ld(v+1):ke=250:gosub6000
  80. 1050 h=0
  81. 1055 for i=1to5:l$(i)=" ":next
  82. 1060 h=h+1
  83. 1062 print"";
  84. 1063 printtab(30);"[160]    "
  85. 1065 gosub9999:if h>1 then1072
  86. 1070 print" paina return[146]";"";tab(30);h;"[157].heitto":goto 1075
  87. 1072 print"";tab(30);h;"[157].heitto":goto1078
  88. 1075 getx$:ifx$=""then1075
  89. 1076 if x$<>chr$(13)then1075
  90. 1078 gosub9999:z=1
  91. 1080 for x=z to 10
  92. 1090 for y=zto5
  93. 1095 if l$(y)="x"then 1110
  94. 1100 n(y)=int(rnd(1)*6)+1
  95. 1105 b$=str$(n(y))
  96. 1106 a$(y)=right$(b$,1)
  97. 1110 nexty
  98. 1120 print"";
  99. 1125 printtab(30);a$(1);"";a$(2);"";a$(3);"";a$(4);"";a$(5)
  100. 1130 nextx
  101. 1135 z=z+1:ifz<6then1080
  102. 1137 h1=hd(0):l1=ld(0):ke=75:gosub6000
  103. 1140 if h=3 then 1500
  104. 1160 for i=1to5
  105. 1165 print"";
  106. 1166 printtab(28+2*i);"";a$(i);"[146]"
  107. 1170 print"";
  108. 1180 printtab(28+2*i);" "
  109. 1190 nexti
  110. 1200 gosub9999
  111. 1205 print" ilmoita uusinnat: ret=kylla, x=ei[146]"
  112. 1210 for i=1to5
  113. 1215 print"";tab(28+2*i);"^";
  114. 1220 get x$:if x$="" then 1220
  115. 1222 if x$="x"orx$=chr$(13)then1225
  116. 1223 goto1220
  117. 1225 l$(i)=x$:ifx$<>"x"then1237
  118. 1227 print"";
  119. 1228 printtab(28+2*i);" [146]"
  120. 1230 print"";
  121. 1235 printtab(28+2*i);a$(i)
  122. 1237 print"";tab(28+2*i);" ";
  123. 1240 nexti
  124. 1242 gosub9999
  125. 1244 print" korjaa (k) tai paina return[146]"
  126. 1246 getd$:if d$=""then1246
  127. 1248 if d$="k"then1160
  128. 1249 if d$<>chr$(13)then1246
  129. 1250 gosub9999:x=0
  130. 1260 for i=1to5
  131. 1262 print"";
  132. 1263 printtab(28+2*i);" "
  133. 1270 if l$(i)="x" then x=x+1
  134. 1275 nexti
  135. 1280 if x<5 then 1290
  136. 1283 for i=1to5
  137. 1285 print"";
  138. 1286 printtab(28+2*i);"";a$(i);"[146]"
  139. 1287 nexti:goto1500
  140. 1290 goto 1060
  141. 1500 for i=1to5
  142. 1510 print"";
  143. 1520 printtab(28+2*i);" "
  144. 1522 nexti
  145. 1525 gosub9999
  146. 1530 print" valitse kirjaimella haluamasi peli[146]"
  147. 1532 print"";tab(31);"        "
  148. 1535 getx$:ifx$=""then1535
  149. 1538 for i=1to18
  150. 1539 ifx$=t$(i)then 1542
  151. 1540 nexti:goto1580
  152. 1542 gosub9999
  153. 1544 print"";tab(31);r$(i);"[146]"
  154. 1545 print" korjaa (k) tai paina return[146]"
  155. 1546 get d$:ifd$=""then1546
  156. 1548 if d$="k"then1525
  157. 1550 ifd$<>chr$(13)then1546
  158. 1555 print"";tab(31);"        "
  159. 1560 goto1600
  160. 1570 nexti
  161. 1580 gosub9999
  162. 1582 h1=hd(v+1):l1=ld(v+1):ke=250
  163. 1583 for i=1to3:gosub6000:next
  164. 1585 print" vaara valinta/yrita uudelleen[146]"
  165. 1590 goto1535
  166. 1600 if pk(v,i)=1 then 1580
  167. 1610 pk(v,i)=1:ix=i:s=0:nn=0
  168. 1615 nn=nn+1:y(nn)=0
  169. 1620 for j=1to5
  170. 1630 if nn=n(j) then y(nn)=y(nn)+1
  171. 1640 nextj
  172. 1650 if nn<6then1615
  173. 1680 ifi>9 then 1690
  174. 1685 oni  goto 1700,1800,1900,2000,2100,2200,2300,2400,2500
  175. 1690 i=i-9
  176. 1695 on i goto 2600,2700,2800,2900,3000,3100,3200,3300,3400
  177. 1700 s=y(1):goto4000
  178. 1800 s=2*y(2):goto4000
  179. 1900 s=3*y(3):goto4000
  180. 2000 s=4*y(4):goto4000
  181. 2100 s=5*y(5):goto4000
  182. 2200 s=6*y(6):goto4000
  183. 2300 goto1580
  184. 2400 goto1580
  185. 2500 for nn=6to1step-1
  186. 2510 if y(nn)< 2 then 2530
  187. 2520 s=2*nn:goto4000
  188. 2530 next nn
  189. 2540 s=0:goto4000
  190. 2600 for nn=6to1step-1
  191. 2610 if y(nn)< 4 then 2630
  192. 2620 s=4*nn:goto4000
  193. 2630 next nn
  194. 2640 for nn=6to1step-1
  195. 2645 if y(nn)< 2 then 2660
  196. 2650 s=2*nn+s
  197. 2655 if s>2*nn then4000
  198. 2660 next nn
  199. 2670 s=0:goto4000
  200. 2700 for nn=6to1step-1
  201. 2710 if y(nn)< 3 then 2730
  202. 2720 s=3*nn:goto4000
  203. 2730 next nn
  204. 2740 s=0:goto4000
  205. 2800 for nn=6to1step-1
  206. 2810 if y(nn)< 4 then 2830
  207. 2820 s=4*nn:goto4000
  208. 2830 next nn
  209. 2840 s=0:goto4000
  210. 2900 for nn=6to1step-1
  211. 2910 if y(nn) >1 then s=0
  212. 2915 if y(nn) >1 then 4000
  213. 2920 nextnn
  214. 2930 if y(6)>0then s=0
  215. 2932 if y(6)>0then 4000
  216. 2935 s=15
  217. 2940 goto4000
  218. 3000 for nn=6to1step-1
  219. 3005 if y(nn) >1 then s=0
  220. 3010 if y(nn) >1 then 4000
  221. 3020 nextnn
  222. 3030 if y(1)>0then s=0
  223. 3032 if y(1)>0then 4000
  224. 3035 s=20
  225. 3040 goto4000
  226. 3100 x=0
  227. 3110 for nn=6to1step-1
  228. 3120 if y(nn)=2 thenx=x+2
  229. 3130 if y(nn)=3 thenx=x+3
  230. 3140 next nn
  231. 3150 if x=5 then 3170
  232. 3160 s=0:goto4000
  233. 3170 for x=1to5
  234. 3180 s=s+n(x)
  235. 3190 nextx:goto4000
  236. 3200 for nn=1to5
  237. 3210 s=s+n(nn)
  238. 3220 nextnn
  239. 3230 goto4000
  240. 3300 for nn=6to1step-1
  241. 3310 if y(nn)<>5 then 3330
  242. 3320 s=50:goto4000
  243. 3330 next nn
  244. 3340 s=0:goto4000
  245. 3400 goto1580
  246. 4000 pt(v,ix)=s
  247. 4005 print""
  248. 4007 if ix<7 then4010
  249. 4008 print"";
  250. 4010 for i=1toix:print:nexti
  251. 4020 printtab(5+5*v);s
  252. 4030 s=0
  253. 4040 for i=1to6
  254. 4050 s=s+pt(v,i)
  255. 4060 next
  256. 4070 if s>62 then pt(v,8)=50
  257. 4080 pt(v,7)=s
  258. 4090 print"";tab(5+5*v);pt(v,7)
  259. 4100 printtab(5+5*v);pt(v,8)
  260. 4110 s=0
  261. 4120 for i=7to 17
  262. 4130 s=s+pt(v,i)
  263. 4140 next
  264. 4145 pt(v,18)=s:ifs>pathenpa=s
  265. 4150 print"";tab(5+5*v);s
  266. 4160 if v<>pm then 1010
  267. 4170 for i=1to6
  268. 4180 if pk(v,i)=0then1010
  269. 4190 next i
  270. 4270 for i=9to17
  271. 4280 if pk(v,i)=0then1010
  272. 4290 next i
  273. 4300 for i=1topm
  274. 4310 ifpt(i,18)<pathen4330
  275. 4320 print"";tab(5+5*i);pa;"[146]"
  276. 4330 next
  277. 4400 for i=6to1step-1
  278. 4410 for j=1toistepi-1
  279. 4420 h1=hd(j):l1=ld(j):ke=125:gosub6000
  280. 4430 nextj:nexti
  281. 5000 gosub9999
  282. 5010 print" [208]eli paattyi. [207]nnea voittajalle![146]"
  283. 5030 goto5030
  284. 6000 poke54296,15
  285. 6010 poke54276,33
  286. 6020 poke54277,0
  287. 6030 poke54278,128
  288. 6040 poke54273,h1:poke54272,l1
  289. 6045 forrh=1toke:next
  290. 6050 poke54296,0
  291. 6060 poke54276,0
  292. 6070 poke54277,255
  293. 6080 poke54278,0
  294. 6090 return
  295. 9999 print"                                        ":return
  296.