home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 193
/
193.d81
/
favor
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
20KB
|
651 lines
1 poke55,0:poke56,159:clr
2 nm$="favor":nn$="amcgs.a": dv=peek(186):ifdv<8thendv=8
3 print"[159][147]":poke53280,0:poke53281,0:poke788,49:tq=ti:poke53371,0:mt=49152
4 sys57812"amcgs.a font",dv,0:poke780,0:poke781,0:poke782,8:sys65493
12 open2,dv,2,nm$+".opts,p,r":input#2,k3,sd,so,cc,sk
14 input#2,bd,fb,mu,wg,pk,rd,kc,kc%(0):close2
17 gosub5500:poke53265,27:onmu+1goto500,482
18 :
19 rem brancher
20 onsd+1goto70,80
24 :
25 rem charge
26 a$="251331421502421502":poke53370,0
27 t=87:pokef+6,96:pokef+24,15
28 fori=1to18step3
29 pokef+1,val(mid$(a$,i,2)):pokef+4,33
30 forj=1tot*val(mid$(a$,i+2,1)):next
31 pokef+4,0:next:fori=ftof+24
32 pokei,0:next:poke53371,0:return
34 rem menu brancher
35 sysmt:poke53269,1
37 sysmt+9:ifl2%then57
41 i=1:geta$:ifa$=""then37
45 ifi>len(ch$)then37
49 ifa$=mid$(ch$,i,1)then59
53 i=i+1:goto45
57 ifcx%<x1+2orcx%>x2-2orcy%<y1+3orcy%>y2-1then37
58 i=(cy%-(y1)-1)/2
59 return
63 :
64 rem print at
65 x=x(i):y=y(i)
66 poke211,x:poke214,y:sys58732:return
68 :
69 rem keybord brancher
70 i=1:geta$:ifa$=""then76
71 ifi>len(ch$)then70
72 ifa$=mid$(ch$,i,1)thenreturn
73 i=i+1:goto71
76 ifjj=nc-2thenjj=-1
77 jj=jj+1:j%=jj+int(rnd(1)*(nc-jj)):temp=s(jj):s(jj)=s(j%):s(j%)=temp:goto70
78 :
79 rem mouse brancher
80 sysmt+9:ifrg%andl2%=1orr2%=1 theni=rg%:return
81 ifjj=nc-2thenjj=-1
82 jj=jj+1:j%=jj+int(rnd(1)*(nc-jj)):temp=s(jj):s(jj)=s(j%):s(j%)=temp:goto 80
88 :
89 rem wrong choice sound
90 poke53370,0:pokef+24,15:pokef+8,4:pokef+12,63:pokef+13,17:pokef+11,33
91 fori=1to100:next:pokef+11,32
92 y=sd:x=20-(len(wm$(wm)))/2:gosub66:printwm$(wm);:fori=1to300:next
93 poke53371,0:return
94 :
95 rem tone & message
96 poke53370,0:pokef+24,15:pokef+5,4:pokef+6,12
97 pokef+4,23:pokef+15,100:pokef+4,20:pokef+1,30:fork=1to350:next:pokef+6,0
98 pokef+4,129:goto92
109 :
110 rem special turn from deck not a sub
111 tc=b%(t2,c(t2)):ts=fns(tc):tv=fnv(tc)
115 gosub270:onplgoto119,640
119 ift2>sf+3orgf=sf+3thenwm=3:gosub90:goto534
120 t2=t2+4:goto620
121 :
122 rem auto
123 tc=b%(t2,c(t2)):ts=fns(tc):tv=fnv(tc)
127 gosub270:onplgoto141,131
131 fork=c(fr)-1to1step-1
133 iffns(b%(fr,k))<>fsthen139
135 iffnv(b%(fr,k))<>fnv(b%(fr,k+1))+1then139
137 nextk
139 mm=k+1:goto1240
141 ift2>sf+3orgf=sf+3thenwm=3:gosub90:goto534
143 t2=t2+4:goto123
149 :
150 rem fill empty spaces
151 iffr=1or(c(0)=0andc(1)=0)then534
152 ifc(fr)>0then534
154 ifc(1)>0then160
156 c(fr)=c(fr)+1:b%(fr,c(fr))=b%(0,c(0)):c(0)=c(0)-1:i=0:gosub250:gosub230
157 ifc(0)=0thensysmt+30,x(0),x(0)+3,y(0),y(0)+4,kt,sk
158 i=fr:gosub200:goto534
160 c(fr)=c(fr)+1:b%(fr,c(fr))=b%(1,c(1)):c(1)=c(1)-1:i=1:gosub200
162 goto158
168 :
169 rem erases pile i
170 ifks(i)=2then174
172 mx=y(i)+sp(i)*(mx(i)-1)+4:sysmt+30,x(i),x(i)+3,y(i),mx,kt,sk:goto177
174 mx=x(i)+sp(i)*(mx(i)-1)+3:sysmt+30,x(i),mx,y(i),y(i)+4,kt,sk
177 return
178 :
179 rem magic :202 other place 203:any card
180 onks(i)goto181,190
181 x=x(i):y=y(i)+sp(i)*(c(i)-1)
182 ify>y(i)+sp(i)*(mx(i)-1)theny=y(i)+sp(i)*(mx(i)-1)
184 gosub66:goto202
190 y=y(i):x=x(i)+sp(i)*(c(i)-1)
192 ifx>x(i)+sp(i)*(mx(i)-1)thenx=x(i)+sp(i)*(mx(i)-1)
194 gosub66:goto202
200 x=x(i):y=y(i):gosub66:ifc(i)=0thengosub170
202 ca=b%(i,c(i)):ifc(i)=0then224
203 poke53370,0:ifso=1then220
214 pokef+1,50:pokef+24,12:pokef+4,129:fort=1to15:next:pokef+4,128:pokef+5,0
220 print"[146]";:printst$(ca);:poke53371,0:return
224 sysmt+30,x,x+3,y,y+4,kt,sk:return
228 :
229 rem print count at i
230 k=len(str$(c(i))):sysmt+30,x(i)-2,x(i)-1,y(i)+3,y(i)+3,kt,sk
234 ifc(i)=0then246
236 x=x(i)-k+1:y=y(i)+3
238 gosub66:print"[156]"right$(str$(c(i)),k-1):return
244 gosub66:print"[156]"right$(str$(c(i)-1),k-1):return
246 ifi=0thensysmt+30,x(0),x(0)+3,y(0),y(0)+4,kt,sk
247 return
248 :
249 rem prints deck at i
250 print"[146]":gosub65
252 poke53370,0:ifso=1then256
254 pokef+1,50:pokef+24,12:pokef+4,129:fort=1to15:next:pokef+4,128:pokef+5,0
256 poke646,cc:printbk$:sysmt+30,x+1,x+2,y+1,y+3,kc%(kc),cc:poke53371,0:return
258 :
259 rem redeal
260 kd=fl(2):ifrd=0thenkd=fl(3)
261 ifre= kdthenwm=9:gosub90:return
262 x=c(1):fori=1tox:b%(0,x)=b%(1,i):x=x-1:next:c(0)=c(1):c(1)=0
263 i=1:gosub65:sysmt+30,x,x+ht+2,y,y+4,kt,sk:i=0:gosub250:gosub230
264 ifht=3thenreturn
265 re=re+1
266 return
268 :
269 will it play
270 pl=1
272 if(t2>gt)and(tc+1=fc)thenpl=2:return
274 ift2>1andt2<sfandtc-1=fcthenpl=2:return
286 return
288 :
289 rem play from klon type waste
290 c(t2)=c(t2)+1:b%(t2,c(t2))=b%(fr,c(fr)):c(fr)=c(fr)-1:
291 y=y(1):x=x(1)+nt-1 :gosub66
292 sysmt+30,x,x+3,y,y+4,kt,sk
294 nt=nt-1:ifnt<1thennt=1
296 i=1:y=y(1):x=x(1)+nt-1:gosub66:gosub202
297 i=t2:gosub180:return
298 :
299 rem print stats
300 x1=2:x2=15:y1=8:y2=19:cl=cc:gosub2100
302 x=x1+2:y=y1+2
306 gosub66:print"[149]played";
307 x=x1+12-len(str$(t6)):gosub66:print"[144]"t6
308 x=x1+2:y=y+2:gosub66:print"high ";
309 x=x1+12-len(str$(hi)):gosub66:print"[144]"hi
310 x=x1+2:y=y+1:gosub66:print"low ";
311 x=x1+12-len(str$(lo)):gosub66:print"[144]"lo
312 x=x1+2:y=y+1:gosub66:print"ave. ";
313 x=x1+12-len(str$(ave)):gosub66:print"[144]"ave
316 x=x1+2:y=y+2:gosub66:print"[156]games";
317 x=x1+12-len(str$(g7)):gosub66:print"[144]"g7
320 x=x1+2:y=y+1:gosub66:print"[156]wins ";
321 x=x1+12-len(str$(nw)):gosub66:print"[144]"nw
326 return
328 :
329 rem clear message
330 ifsd=1then342
332 print"[146]"
334 sysmt+30,0,29,0,0,100,bd
338 x=30:y=0:gosub66 :print"[146][144][163]h-help[146][174]":return
342 sysmt+30,0,39,1,1,kt,sk:return
366 :
367 rem declare win
368 ifso=0thengosub26
370 nw=nw+1:wf=1
372 x1=21:x2=34:y1=2:y2=06:cl=2:gosub2300
374 y=y1+2:x=x1+3:gosub66:print"youwin ":return
388 :
389 rem update stats
390 g7=g7+1:t6=0:ifwf=1thent6=52:goto392:rem t6=nc in most
391 fori=sftonp:t6=t6+c(i):next
392 g8=g8+t6:av=int(g8/g7+.5):ift6<lothenlo=t6
394 ift6>hithenhi=t6
395 ifg7=1thenhi=t6:lo=t6
396 wf=0:return
408 :
409 rem alternate heading
410 ifsd=1then418
412 ms=0:sysmt+30,0,39,0,0,100,bd
413 poke53269,0
414 fori=1togt+1:gosub65:print"[144][145]"mid$(sc$,i,1):next:return
418 ifsd=1thenms=1:sysmt+30,0,39,07,24,kt,sk:x=0:y=0:gosub66:printcm$
420 return
438 :
439 rem spread graphics
440 print"[146]":ifk>36then442
441 x=1:y=4:forj=1tok:gosub66:c(i)=j:gosub202:x=x+1:next:goto447
442 x=1:y=4:forj=1to36:gosub66:c(i)=j:gosub202:x=x+1:next:ifk>72then445
444 x=1:y=10:forj=37tok:gosub66:c(i)=j:gosub202:x=x+1:next:goto447
445 x=1:y=10:forj=37to72:gosub66:c(i)=j:gosub202:x=x+1:next
446 x=1:y=16:forj=73tok :gosub66:c(i)=j:gosub202:x=x+1:next
447 return
480 :
481 rem menu opening
482 gosub5000
484 onigoto500,486,488,39000
486 gosub5400:goto482
488 ifrd%(1)=0andrd%(2)=0thenwm=0:gosub330: gosub90:gosub5000:goto484
490 goto502
498 :
499 new game
500 fori=1tonc:rd%(i) =s(i-1):next:c(0)=nc:re=0 :kd=fl(2):ifrd=0thenkd=fl(3)
502 sysmt+42,216:fori=1tonp:c(i)=0:k(i)=0:next
503 sysmt:gosub410
504 fori=1tonc:b%(0,i)=rd%(i):next:c(0)=nc
508 fori=14to17:c(i)=1:b%(i,1)=13*(i-14):gosub200:next
512 fori=2to13:c(i)=c(i)+1:b%(i,c(i))=b%(0,c(0)):c(0)=c(0)-1:gosub200:next
520 i=0:gosub250:gosub230
530 sysmt:ifsd=1then poke53269,1
532 fork=0tonp:mm(k)=c(k):next:sysmt+39,144:t6=0
534 gosub330:print"[146]";:wm=4
535 y=sd:x=20-(len(wm$(wm)))/2:gosub66:printwm$(wm);
537 ch$=fr$:pokev+1,np+7: gosub20
538 gosub330:ifi>6then544
540 onigoto 542,3000,850,4000,4004,1620
542 nw=nw+1:wf=1:ifso=0thengosub26
543 x1=21:x2=34:y1=2:y2=6:cl=2:gosub2300:y=4:x=24:gosub66:print"youwin ":goto4000
544 i=i-6 :iffl(1)<>3theni=i-1
545 fork=0togf:mm(k)=c(k):oo(k)=b%(k,1): next:sysmt+39,144
546 fr=i:sr=re:iffr=0thenonfl(1)goto552,577, 1
547 ifc(fr)=0thenwm=1:gosub90:goto534
548 iffr>gtthen534
549 goto600
550 :
551 rem turn three
552 ifc(0)=0andc(1)=0thenwm=1:gosub90:goto534
554 ifc(0)=0thengosub260:goto534
556 ht=fl(4):ifrd=0thenht=fl(5)
557 ut=nt:ifut<2then560
558 sysmt+30,x(1),x(1)+ht+2,y(1),y(1)+4,kt,sk:i=1:gosub200:form=1to350:next
560 nt=ht:ifnt=1then564
562 nt=ht:ifc(0)<htthennt=c(0)
564 i=1:forj=1tont:b%(1,c(1)+1)=b%(0,c(0)):c(1)=c(1)+1
565 ifc(0)=0thengosub246:goto570
566 c(0)=c(0)-1:ca=b%(1,c(1))
568 x=x(1)+j-1:y=y(1):gosub66:gosub202
570 next:i=0:gosub230:goto534
573 :
574 rem turn one to each tab
577 fori=lttogt:ifc(0)=0thenwm=1:gosub90:goto534
579 c(i)=c(i)+1:b%(i,c(