home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun: Strategy Games 1 / rerun-strategygamesI.d64 / tri-solitaire (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  6KB  |  164 lines

  1. 2 printchr$(147)"would you like instructions (y/n)?
  2. 4 [161] a$: [139] a$[179][177] "y" [175] a$[179][177]"n" [167] 4
  3. 6 [139] a$[178]"n" [167] 36
  4. 8 [153]"instructions on screen or printer (s/p)?
  5. 10 get b$: if b$<> "s" and b$<>"p" then 10
  6. 12 if b$="s"then  d=3
  7. 14 if b$="p" then d=4
  8. 16 open d,d
  9. 20 print#d,"tri-solitaire
  10. 22 [152]d,"by jim and deborah chambers
  11. 24 print#d,"run it right: c-64
  12. 26 [152]d,"
  13. 28 print#d,"tri-solitaire uses a regular card deck
  14. 30 [152]d,"with all the face cards removed. 16 of
  15. 32 print#d,"the cards (referred to as table cards)
  16. 34 [152]d,"are dealt face up in a four-by-four
  17. 36 print#d,"pattern. the remaining cards make up
  18. 38 [152]d,"your hand.
  19. 40 print#d,"
  20. 44 [152]d,"the object is to play each card in your
  21. 46 print#d,"hand on a table card so that the total
  22. 48 [152]d,"of the other three cards in that row
  23. 50 print#d,"or column equals the value of your card
  24. 52 [152]d,"or its value plus a multiple of ten.
  25. 54 print#d,"for example, if you play a seven, the
  26. 56 [152]d,"total of the other three cards in that
  27. 58 print#d,"row or column must equal seven, 17 or
  28. 60 [152]d,"27. you can't play your card on a
  29. 62 print#d,"table card of the same value, and aces
  30. 63 [152]d,"always count as one.":[139] d[178]4 [167] 67
  31. 65 [153]"press a key to continue"
  32. 66 [161] dd$:[139] dd$[178]"" [167] 66
  33. 67 [152]d,"
  34. 68 print#d,"to play a card, enter two characters
  35. 70 [152]d,"consisting of a letter (a-d) and a
  36. 72 print#d,"number (1-4), such as b2, which would
  37. 74 [152]d,"be the location of the table card you
  38. 76 print#d,"want to replace. if you make a good
  39. 78 [152]d,"play, the card you hold replaces the
  40. 80 print#d,"designated table card, and your score,
  41. 82 [152]d,"displayed in the upper-right corner, is
  42. 84 print#d,"increased by one.
  43. 86 [152]d,"
  44. 88 print#d,"you can flip through your hand with the
  45. 90 [152]d,"left arrow key. play the cards you hold
  46. 92 print#d,"in any order. the game is over when you
  47. 94 [152]d,"reach a score of 24 or exceed the eight
  48. 96 print#d,"minute time limit.
  49. 98 [152]d,"":[160]d
  50. 100 [153]"press any key to run the program..."
  51. 102 [161] e$:[139] e$[178]"" [167] 102
  52. 104 [156]
  53. 200 [143] tri-solitaire by jim & deborah chambers
  54. 202 [151]56,56:[156]:cl$[178][199](147):[153]cl$:[151]53280,6:[151]53281,0
  55. 204 [153][163]12)[199](158)[199](18)" tri-solitaire "[199](146):p[178]49152:q[178]p[170]23
  56. 206 [134]p(4,4),cc(4,4),cs(3,40),d(13):x[178][187]([171]ti[173]37):dc[178]54272:lm[178]8
  57. 208 [151]53282,1:[151]53283,7:[129]i[178]1[164]5:[153]:[130]:[153][199](5)"rules:":[153]
  58. 210 [153]"this game is played with one regular"
  59. 212 [153]"deck with face cards removed. sixteen"
  60. 214 [153]"cards are dealt on the table. the"
  61. 216 [153]"remaining cards are your hand. the
  62. 218 print"object is to play each card in your"
  63. 220 print"hand on a table card so that the total"
  64. 222 print"of the other three cards in that row or"
  65. 224 print"column equal the value of your card or"
  66. 226 print"its value plus a multiple of ten. you"
  67. 228 print"may not play your card on a card of the"
  68. 230 print"same value. suits do not matter, and"
  69. 232 print"aces always equal one.":fori=ptop+40:readd:pokei,d:next
  70. 234 fori=1to4:forj=1to4:p(i,j)=1188+(i-1)*240+(j-1)*6:next:next:gosub350
  71. 236 printcl$:printchr$(5)"to specify the table card that you wish"
  72. 238 print"to play on, enter a two digit command,"
  73. 240 print"a letter (a-d) plus a number (1-4)."
  74. 242 print"you can examine the cards in your hand"
  75. 244 print"by pressing the "chr$(34)chr$(95)chr$(34)" key and <return>."
  76. 246 print"you may play your cards in any order."
  77. 248 print:print"a perfect score = 24 points.":print
  78. 250 print"there are two versions of the game:"
  79. 252 print" 1. novice: no time limit."
  80. 254 print" 2. expert: time limit of eight minutes."
  81. 256 sysp,23,6:print"your choice (1 or 2)?":gosub352:gosub384
  82. 258 tt=val(a$):iftt<1ortt>2then256
  83. 260 poke56334,peek(56334)and254:poke1,peek(1)and251:sysq
  84. 262 fori=14624to14631:pokei,peek(i+39144):next
  85. 264 fori=14632to14639:pokei,peek(i+39280):next
  86. 266 fori=14640to14647:pokei,peek(i+39312):next
  87. 268 fori=14648to14655:pokei,peek(i+39320):next
  88. 270 poke1,peek(1)or4:poke56334,peek(56334)or1
  89. 272 poke53272,(peek(53272)and240)or14:poke53265,peek(53265)or64
  90. 274 bl$="":fori=1to12:bl$=bl$+chr$(32):next:pl$="play to":im$="illegal move"
  91. 276 fori=1to13:readd(i):next:sy=5:sx=34:p1=22:p2=27:ty=7:tx=34
  92. 278 s=0:gosub400:fori=1to40:cs(1,i)=i:next
  93. 280 fori=1to40:aa=i+int((40-i)*rnd(0)):tp=cs(1,aa)
  94. 282 forj=aatoistep-1:cs(1,j)=cs(1,j-1):next:cs(1,i)=tp:next
  95. 284 fori=1to40:nn=cs(1,i):ifnn<11thencs(1,i)=nn:cs(2,i)=100:cs(3,i)=0:goto292
  96. 286 ifnn<21thencs(1,i)=nn-10:cs(2,i)=101:cs(3,i)=2:goto292
  97. 288 ifnn<31thencs(1,i)=nn-20:cs(2,i)=102:cs(3,i)=0:goto292
  98. 290 cs(1,i)=nn-30:cs(2,i)=103:cs(3,i)=2
  99. 292 next:printcl$
  100. 294 fori=1051to1063:forj=0to80step40:pokei+j,160:pokei+j+dc,7:next:next
  101. 296 fori=1091to1103:pokei,d(i-1090):pokei+dc,0:next
  102. 298 fori=1050to1024step-1:pokei,160:pokei+dc,7:next
  103. 300 fori=1064to1984step40:pokei,160:pokei+dc,7:next
  104. 302 fori=1to4:poke(i*6+1022),i+176:poke(i*6+1022+dc),0:next
  105. 304 fori=1to4:poke(i*240+944),i+128:poke(i*240+944+dc),0:next
  106. 306 fori=1to4:forj=1to4:z=p(i,j):gosub356:next:next
  107. 308 c=0:fori=1to4:forj=1to4:z=p(i,j):c=c+1:gosub358:cc(i,j)=cc:next:next
  108. 310 z=1697:c=c+1:gosub356:gosub358:sysp,sy,28:print"score: 0"
  109. 312 sysp,ty,28:print"time: 00:00":ti$="000000"
  110. 314 sysp,p1,p2:printbl$:sysp,p1,p2:printpl$;:pp$="":inputpp$:ifpp$<>"_"then326
  111. 316 gosub404:iffl>0then410
  112. 318 ifc=40then314
  113. 320 fori=1to3:t(i)=cs(i,c):next
  114. 322 fori=cto39:forj=1to3:cs(j,i)=cs(j,i+1):next:next
  115. 324 fori=1to3:cs(i,40)=t(i):next:z=1697:gosub358:goto314
  116. 326 iflen(pp$)<>2then376
  117. 328 y$=left$(pp$,1):x$=right$(pp$,1):y=asc(y$)-64:x=val(x$)
  118. 330 ify<1ory>4orx<1orx>4then376
  119. 332 z=p(y,x):n=cs(1,c)
  120. 334 t1=0:t2=0:fori=1to4:t1=t1+cc(y,i):t2=t2+cc(i,x):next
  121. 336 t1=t1-cc(y,x):t2=t2-cc(y,x):ifn=cc(y,x)then376
  122. 338 ift1=nort1=n+10ort1=n+20ort1=n+30ort2=nort2=n+10ort2=n+20ort2=n+30then342
  123. 340 goto376
  124. 342 z=1697:gosub356
  125. 344 z=p(y,x):gosub358:cc(y,x)=n:s=s+1:gosub404:iffl>0then410
  126. 346 sysp,sy,sx:prints:ifs=24then388
  127. 348 gosub384:c=c+1:z=1697:gosub358:goto314
  128. 350 sysp,23,6:printchr$(18)chr$(158)" press any key to continue "
  129. 352 geta$:ifa$=""then352
  130. 354 return
  131. 356 fork=z-82toz-78:forl=0to160step40:pokek+l,96:pokek+l+dc,1:next:next:return
  132. 358 cc=cs(1,c):cp=cs(2,c):fc=cs(3,c)
  133. 360 pokez-81,96:pokez-81+dc,1:pokez+81,96:pokez+81+dc,1
  134. 362 ifcc=10then368
  135. 364 ifcc=1then372
  136. 366 pokez-82,cc+112:pokez-82+dc,0:pokez+82,cc+112:pokez+82+dc,0:goto374
  137. 368 pokez-82,113:pokez-81,112:pokez-82+dc,0:pokez-81+dc,0
  138. 370 pokez+81,113:pokez+82,112:pokez+81+dc,0:pokez+82+dc,0:goto374
  139. 372 pokez-82,65:pokez-82+dc,0:pokez+82,65:pokez+82+dc,0
  140. 374 pokez,cp:pokez+dc,fc:return
  141. 376 sysp,p1,p2:printim$:fori=1to10:poke54296,15:forj=1to3:next
  142. 378 poke54296,0:forj=1to2:next:next:gosub404
  143. 380 iffl>0then410
  144. 382 goto314
  145. 384 pokedc+24,15:pokedc+1,110:pokedc+5,9:pokedc+6,9:pokedc+4,17:pokedc+4,16
  146. 386 return
  147. 388 fori=0to15:poke53280,i:forj=0to100:next:gosub394:next:poke53280,6
  148. 390 sysp,p1,p2:print"play again?";:gosub352:ifa$="y"thengosub400:goto278
  149. 392 sys58260
  150. 394 sysp,p1,p2:printbl$:fork=0to50:next:sysp,p1,p2:print" winner!"
  151. 396 ifi/5=int(i/5)thengosub384
  152. 398 return
  153. 400 printcl$:poke53281,12:sysp,12,6:printchr$(144)"shuffling the cards now..."
  154. 402 return
  155. 404 fl=0:mm$=mid$(ti$,3,2):ss$=right$(ti$,2):mm=val(mm$):tt$=mm$+":"+ss$
  156. 406 sysp,ty,tx:printtt$:iftt=2andmm>=lmthenfl=1
  157. 408 return
  158. 410 fori=1to10:sysp,p1,p2:printbl$:fort=0to100:next
  159. 412 sysp,p1,p2:print"game over":fort=0to150:next:next:goto390
  160. 414 data 32,13,192,132,251,32,13,192,166,251,76,240
  161. 416 data 255,32,253,174,32,158,173,32,170,177,96
  162. 418 data 160,0,185,0,208,153,0,56,185,0,209,153,0,57,200,208,241,96
  163. 420 data 148,146,137,173,147,143,140,137,148,129,137,146,133
  164.