home *** CD-ROM | disk | FTP | other *** search
- 100 ct=37888+4*(peek(36866)and128):poke36879,8:a=rnd(0)
- 110 l$=" "
- 120 print"[147][159]backgammon"
- 130 input"will i go first y[157][157][157]";mf$
- 140 dimb(25):dimr(3):deffnr(x)=int(rnd(x)*6)+1
- 150 deffnp(x)=ct-((x-(x>6))*22+y)*(x<13)-((26-(x+(x<19)))*22-y-1)*(x>12)
- 160 data2,0,0,0,0,-5,0,-3,0,0,0,5,-5,0,0,0,3,0,5,0,0,0,0,-2
- 170 forx=1to24:readb(x):nextx
- 180 print"[147] backgammon ";
- 190 forx=1to12:printchr$(64+x);"[146][144][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209]";chr$(89-x);
- 200 ifx=6thenprint" bar [146][144][209][209][209][209][209][209][209][209][209][209][209][209] bar ";
- 210 nextx:print" [146][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175] ";
- 220 print"[146][158]player [209] computer [209]"
- 230 forx=1to24:ifb(x)=0then270
- 240 z=abs(b(x)):ifz>10thenz=10
- 250 fory=1toz
- 260 pokefnp(x),6.5-sgn(b(x))/2:nexty
- 270 nextx:x=1:z=ct+170
- 280 ifx<7andx<=b(0)thenpokez,6:z=z-1:x=x+1:goto280
- 290 x=1:z=ct+159
- 300 ifx<7andx<=-pbthenpokez,7:z=z+1:x=x+1:goto300
- 310 gosub1130:print"[159]";
- 320 ifleft$(mf$,1)="n"thenprint"player ";:goto340
- 330 print"computer ";
- 340 print"roll";:if f$="dr"ort$="draw"then360
- 350 r(0)=fnr(x):r(1)=fnr(x):r(2)=0:r(3)=0:ifr(0)=r(1)thenr(2)=r(1):r(3)=r(1)
- 360 forx=0to3:ifr(x)>0thenprint" ";chr$(r(x)+48);"[146]";
- 370 nextx:print
- 380 ifleft$(mf$,1)="n"then830
- 390 print"thinking...[145]"
- 400 ob=0:forz=0to18:ifb(z)>0then420
- 410 nextz:ob=1
- 420 h=0:hp=0:hr=0:fory=0to3:x=0:ifr(y)=0then580
- 430 e=0
- 440 ifb(x)<1orr(y)+x>25then570
- 450 ifx=0andb(x)>0thene=e+128
- 460 ifx+r(y)=25thene=e+64
- 470 ifb(x)=1andb(x+r(y))=1thene=e+32
- 480 ifb(x)<>2andb(x+r(y))>0thene=e+16
- 490 ifb(x+r(y))=-1thene=e+8
- 500 ifx<19thene=e+4
- 510 ifb(x+r(y))<-1or(ob=0and(x+r(y))=25)then570
- 520 e=e+1:ify=3orx+r(y)=25orb(x+r(y))>0then560
- 530 z=y+1
- 540 ifr(z)>0andx+r(y)-r(z)>-1andx+r(y)-r(z)<25thenifb(x+r(y)-r(z))>0thene=e+2:goto560
- 550 z=z+1:ifz<4then540
- 560 ifh<ethenh=e:hr=r(y):hp=x
- 570 x=x+1:ifx<25then430
- 580 nexty
- 590 ifh<128andb(0)>0then680
- 600 ifh>0then700
- 610 lr=7:fory=0to3
- 620 if r(y)<lrandr(y)>1thenlr=r(y):ln=y
- 630 nexty:iflr=7then680
- 640 forx=0to25-lr:ifb(x)>0then680
- 650 nextx:x=26-lr
- 660 ifb(x)>0thenr(ln)=25-x:goto400
- 670 x=x+1:ifx<25then660
- 680 print"can not move[146]":mf$="n"
- 690 geta$:on-(a$="")goto690:goto310
- 700 forx=0to3:ifr(x)<>hrthennextx
- 710 r(x)=0
- 720 ifb(hp)<11andhp>0theny=b(hp):pokefnp(hp),0
- 730 b(hp)=b(hp)-1:z$=chr$(hp+hr+64):ifhp+hr>24thenz$="off"
- 740 x$=chr$(hp+64):ifhp=0thenx$="bar"
- 750 print"move from ";x$;" to ";z$
- 760 ifb(hp+hr)=-1thenpb=pb-1:b(hp+hr)=0:ifpb>-7thenpokect+158-pb,7
- 770 ifhp=0andb(0)<8thenpokect+170-b(0),0
- 780 y=b(hp+hr)+1:b(hp+hr)=y
- 790 ifhp+hr<25andy<11thenpokefnp(hp+hr),6:goto810
- 800 ifb(25)=15thengosub1130:print"i win.":goto1160
- 810 forx=0to3:ifr(x)>0then390
- 820 nextx:mf$="n":goto690
- 830 print"move from";:ifpb<0thenprint" bar":hp=25:f$="y":goto880
- 840 inputf$:f$=left$(f$,2):iff$="no"thenmf$="":goto310
- 850 iff$="dr"then180
- 860 iff$<"a"orf$>"x"then1120
- 870 hp=asc(f$)-64:ifb(hp)>=0then1120
- 880 input"[157][157][157][157][157][157][157][157]to";t$:hp=asc(f$)-64:hr=asc(f$)-asc(t$):ift$="no"thenmf$="":goto310
- 890 ift$="draw"then180
- 900 x=0:ift$="off"thenhr=hp
- 910 printl$;"[145]";
- 920 forx=0to3:ifhr<>r(x)thennextx:on-(hr<>hp)goto1120
- 930 ob=x:ifhr<>hpthen980
- 940 z=hp+1:forob=0to3:ifr(ob)=hpthenz=7:goto960
- 950 ifr(ob)<hpthennextob:goto1120
- 960 forx=zto24:ifb(x)<0then1120
- 970 nextx
- 980 ifb(hp-hr)>1andhp<>hrthen1120
- 990 ifb(hp-hr)>0andhp<>hrthenb(hp-hr)=0:b(0)=b(0)+1:ifb(0)<7thenpokect+171-b(0),6
- 1000 y=-pb:m=7:z=ct+158+y:pb=pb+1
- 1010 ifhp<25thenpb=pb-1:y=-b(hp):b(hp)=b(hp)+1:z=fnp(hp):m=11
- 1020 ify<mthenpokez,0
- 1030 ifhp=hrthen1080
- 1040 y=b(hp-hr)-1:b(hp-hr)=y:ifb(hp-hr)>10then1100
- 1050 y=-y:z=fnp(hp-hr)
- 1060 ify<11thenpokez,7
- 1070 goto 1100
- 1080 po=po+1
- 1090 ifpo=15thengosub1130:print"you win.":goto1160
- 1100 r(ob)=0:forx=0to3:ifr(x)>0then830
- 1110 nextx:mf$="":goto310
- 1120 print"illegal move[157][157][157][157][157][157][157][157][157][157][157][157][145]";:goto830
- 1130 poke214,16:print:poke211,0
- 1140 forx=1to5:printl$:nextx:printl$;
- 1150 poke214,16:print:poke211,0:return
- 1160 input"play again (y/n)";a$:ifleft$(a$,1)="y"thenrun
-