home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 2 #1
/
Commodore_Disk_User_Vol.2_1_1988_-.d64
/
addit
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
3KB
|
91 lines
10 rem ** addit **
20 rem ** by d.butcher **
30 poke53280,0:poke53281,0:printchr$(142)chr$(8):dima(64),b(7,7)
40 print"[147]"tab(17)"[158]addit":b$=" "
50 b1$="[176][192][192][178][192][192][178][192][192][178][192][192][178][192][192][178][192][192][178][192][192][178][192][192][174]":b2$="[221] [221] [221] [221] [221] [221] [221] [221] [221]"
60 b3$="[171][192][192][219][192][192][219][192][192][219][192][192][219][192][192][219][192][192][219][192][192][219][192][192][179]":b4$="[173][192][192][177][192][192][177][192][192][177][192][192][177][192][192][177][192][192][177][192][192][177][192][192][189]"
70 d$="":l$=left$(d$,22)
80 print"do you require instructions (y/n) ? ";:gosub720:printa$:ifa$="y"thengosub760
90 print"how many players ? ";:gosub740:printa$:n=val(a$):ifn=2then110
100 print:input"what is your name ";p1$:p2$="the computer":goto130
110 print:input"what is your name, player 1 ";p1$
120 print:input"what is your name, player 2 ";p2$:p2$=left$(p2$,12)
130 p1$=left$(p1$,12):n1=25+int((15-len(p1$))/2):n2=25+int((15-len(p2$))/2)
140 print"[147]"b1$:fory=0to6:printb2$:printb3$:next
150 printb2$:printb4$:print""tab(29)"scores":printtab(29)"[192][192][192][192][192][192]"
160 printleft$(d$,6)tab(n1)p1$:printleft$(d$,12)tab(n2)p2$:n3=n1-20:n4=n2-20
170 printl$tab(10)"please wait a moment"
180 r=1:forc=1to64:a(c)=c:next:forc=64to1step-1:readd:e=int(rnd(0)*c)+1:v=a(e)-1
190 ife<cthenforh=etoc-1:a(h)=a(h+1):next
200 h=int(v/8):v=v-8*h:b(h,v)=d:gosub330:next:s1=0:s2=0:gosub590
210 p=1:gosub380:iff=0then230
220 p=2:gosub400:iff<>0then210
230 printl$b$l$;:onsgn(s2-s1)+2gosub260,290,300
240 printd$tab(10)"another game (y/n) ?";:gosub720:ifa$="y"thenrestore:goto140
250 print"[147]"chr$(9):end
260 t=20-int((len(p1$)+17)/2):printtab(t)p1$" won by"(s1-s2)"point";
270 ifs1-s2>1thenprint"s"
280 return
290 printtab(12)"it's a draw ! ":return
300 t=20-int((len(p2$)+17)/2):printtab(t)p2$" won by"(s2-s1)"point";
310 ifs2-s1>1thenprint"s"
320 return
330 cd=h*2+2:l1$=left$(d$,cd):cr=v*3+1:d=b(h,v)
340 printl1$tab(cr)"[146]";:ifr=2thenprint"";
350 ifd=50thenprint"**[146]":b1=h:b2=v:return
360 ifd=-50thenprint" [146]":return
370 printright$(" "+str$(d),2)"[146]":return
380 f=300:forv=0to7:f=f+b(b1,v):next:iff=0thenreturn
390 n$=p1$:xx=1:yy=0:gosub420:return
400 f=300:forh=0to7:f=f+b(h,b2):next:iff=0thenreturn
410 n$=p2$:xx=0:yy=1:gosub420:return
420 y=b1:x=b2:ifn=2orp=1then440
430 printl$b$l$tab(12)"i'm thinking....":gosub600:goto540
440 t=20-int((len(n$)+12)/2):printl$b$l$tab(t)"your turn, "n$
450 geta$:ifa$=""then450
460 ifa$<>" "then520
470 x1=x:y1=y
480 y=y+yy:ify>7theny=0
490 x=x+xx:ifx>7thenx=0
500 z=b(y,x):ifabs(z)=50then480
510 r=1:h=y1:v=x1:gosub330:r=2:h=y:v=x:gosub330:goto450
520 ifa$<>chr$(13)then450
530 ifabs(b(y,x))=50then450
540 ifn=1andp=2thenr=2:h=y:v=x:gosub330
550 r=1:h=b1:v=b2:b(h,v)=-50:gosub330:h=y:v=x:z=b(h,v):b(h,v)=50:gosub330
560 ifp=1thens1=s1+z
570 ifp=2thens2=s2+z
580 printleft$(d$,19)tab(13)"last taken :"z"[157] "
590 printleft$(d$,8)tab(30)s1"[157] ":printleft$(d$,14)tab(30)s2"[157] ":return
600 m=-50:g=-1:fora1=0to7:d=b(a1,b2):ifabs(d)=50then710
610 x2=-50:fora2=0to7:ifa2<>b2thenk=b(a1,a2):ifk<>-50andk>x2thenx2=k:s=a2
620 next:ifx2<>-50then640
630 ifd>mthenm=d:g=a1:goto710
640 ifg<0theng=a1
650 fora2=0to7:q=b(a2,s):ifq=-50ora2=a1then700
660 y2=-50:fora3=0to7:w=b(a2,a3):ifa3=sthen680
670 ifabs(w)<>50andw>y2theny2=w
680 next:ify2=-50theny2=0
690 l=d-x2+q-y2:ifl>mthenm=l:g=a1
700 next
710 next:y=g:return
720 geta$:ifa$<>"y"anda$<>"n"then720
730 return
740 geta$:ifa$<>"1"anda$<>"2"then740
750 return
760 print" addit is a board game for 1-2 players."
770 print" every square on the board has a value,"
780 print" and you score points by landing on the"
790 print" squares. you may move in one direction"
800 print" only - horizontally or vertically. you"
810 print" must press the space bar to move from"
820 print" square to square and then press return"
830 print" to score, but beware - some squares on"
840 print" the board contain minus values !"
850 printtab(6)"press space bar to continue."
860 geta$:ifa$<>" "then860
870 print"[147]":return
880 data15,10,9,9,8,8,7,7,7,6,6,6,5,5,5,5,4,4,4,4,3,3,3,3,3
890 data2,2,2,2,2,1,1,1,1,1,0,0,0,0,0,-1,-1,-1,-1,-2,-2,-2,-2
900 data-3,-3,-3,-3,-4,-4,-4,-5,-5,-5,-6,-6,-7,-7,-9,50