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