Home » Archimedes archive » Archimedes World » AW-1992-09.adf » AWSept92 » !AWSept92/Goodies/Draughts/!Draughts/!RunImage
!AWSept92/Goodies/Draughts/!Draughts/!RunImage
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Archimedes World » AW-1992-09.adf » AWSept92 |
Filename: | !AWSept92/Goodies/Draughts/!Draughts/!RunImage |
Read OK: | ✔ |
File size: | B12E bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM><Draughts$Dir>.!RunImage 20ONERROR PROCerror(REPORT$+" (internal error code "+(STR$ERL)+")",TRUE) 30PROCinit 40ONERROR PROCerror(REPORT$+" (internal error code "+STR$ERL+")",FALSE) 50mask%=0 60REPEAT 70PROCpoll 80IF playing% THEN PROCcheckifwon 90IF playing% AND Plyr1=1 AND Go=1 THEN 100PROCcompgo 110PROCsetgoicon(TRUE) 120ENDIF 130PROCpoll 140IF playing% THEN PROCcheckifwon 150IF playing% AND Plyr2=1 AND Go=2 THEN 160PROCcompgo 170PROCsetgoicon(TRUE) 180ENDIF 190UNTIL finished% 200 210DEFPROCend 220SYS"Wimp_CloseDown",task_handle%,&4B534154 230END 240 250DEFPROCpoll 260SYS"Wimp_Poll",mask%,block% TO reason% 270CASE reason% OF 280WHEN 2:PROCopen 290WHEN 3:PROCclose 300WHEN 6:PROCclick(block%!8,block%!12,block%!16) 310WHEN 7:PROCdragdone 320WHEN 8:PROCkeypressed(!block%,block%!4,block%!24) 330WHEN 9:PROCdecodemenu 340WHEN 17,18:PROCmessage 350ENDCASE 360ENDIF 370ENDPROC 380 390DEFPROCerror(err$,fatal%) 400SYS"Wimp_DragBox",,0 410!block%=ERL 420$(block%+4)=err$ 430SYS"Wimp_ReportError",block%,1,"Draughts" 440IF fatal% THEN SYS"Wimp_CloseDown",task_handle%,&4B534154 450ENDPROC 460 470DEFPROCinit 480SYS"Wimp_Initialise",200,&4B534154,"Draughts" TO ,task_handle% 490DIM block% 5500,block2% 1024 500DIM main2% 4500,main3% 5500 510DIM ind1% 49,ind2% 49,ind3% 350,ind4% 0,ind5% 30,ind6% 260,ind7% 0,ind8% 0 520DIM pane% 920 530DIM pixel 16:?pixel=0 540FORp=1TO16:pixel?p=15:NEXT 550SYS"Wimp_SlotSize",-1,-1 TO slotsize 560PROCsetupvarsndims 570grblacked=-1 580dimension=0:PROCvars3d 590sprites%=(HIMEM+1)+(8192) 600WHILE (sprites% DIV 4)<> sprites%/4 610sprites%+=1 620ENDWHILE 630PROCloadsprites 640SYS"Wimp_OpenTemplate",,"<Draughts$Dir>.Templates" 650SYS"Wimp_LoadTemplate",,main2%,ind1%,ind1%+49,-1,"main2D",0 660main2%!64=sprites% 670SYS"Wimp_LoadTemplate",,main3%,ind2%,ind2%+49,-1,"main3D",0 680main3%!64=sprites% 690SYS"Wimp_CreateWindow",,main3% TO main_handle% 700SYS"Wimp_LoadTemplate",,block%,ind3%,ind3%+350,-1,"info",0 710block%!64=sprites% 720SYS"Wimp_CreateWindow",,block% TO info_handle% 730SYS"Wimp_LoadTemplate",,block%,ind4%,ind4%+0,-1,"stepthru",0 740block%!64=sprites% 750SYS"Wimp_CreateWindow",,block% TO stepthru_handle% 760SYS"Wimp_LoadTemplate",,block%,ind5%,ind5%+30,-1,"players",0 770block%!64=sprites% 780SYS"Wimp_CreateWindow",,block% TO players_handle% 790SYS"Wimp_LoadTemplate",,block%,ind6%,ind6%+260,-1,"saveas",0 800SYS"Wimp_CreateWindow",,block% TO save_handle% 810SYS"Wimp_LoadTemplate",,block%,ind8%,ind8%+0,-1,"graphics",0 820SYS"Wimp_CreateWindow",,block% TO graphics_handle% 830SYS"Wimp_LoadTemplate",,pane%,ind7%,ind7%+0,-1,"pane",0 840SYS"Wimp_CloseTemplate" 850filename$="DrghtsGame" 860PROCsetupboarddata 870PROCfindgraphics 880PROCsetupmenus 890PROCloadfile_startedwith 900!block%=-1:block%!4=0:block%!8=0 910block%!12=84:block%!16=68:block%!20=&3002 920$(block%+24)="!Draughts" 930SYS"Wimp_CreateIcon",,block% TO iconbar% 940ENDPROC 950 960DEFPROCsetupboarddata 970numsq()=1,3,5,7,8,10,12,14,17,19,21,23,24,26,28,30,33,35,37,39,40,42,44,46,49,51,53,55,56,58,60,62 980!block%=main_handle% 990FOR ic=0 TO 31 1000icn=numsq(ic) 1010block%!4=icn 1020SYS"Wimp_GetIconState",,block% 1030xcoord(icn)=(block%!8 + block%!16)/2 1040yrow=(icn DIV 8)+1 1050ycoord(yrow)=block%!12 1060sqsizes(0,icn)=block%!8 1070sqsizes(1,icn)=block%!12-4 1080sqsizes(2,icn)=block%!16 1090sqsizes(3,icn)=block%!20 1100NEXT 1110ENDPROC 1120 1130DEFPROCloadsprites 1140S%=OPENIN"<Draughts$Dir>.Sprites" 1150spl=EXT#S%+16 1160CLOSE#S% 1170PROCslotsize(slotsize+spl+16384) 1180IF nslot<(slotsize+spl) THEN 1190PROCerror("Insufficient memory to load application Sprites file - need approximately 20k.",FALSE):PROCend 1200ENDIF 1210slotsize+=spl+16384 1220!block%=spl:block%!4=0 1230sprites%!8=16:sprites%!12=16 1240REM **** SYS"OS_SpriteOp",265,sprites% **** 1250SYS"OS_SpriteOp",266,sprites%,"<Draughts$Dir>.Sprites" 1260ENDPROC 1270 1280DEFPROCfindgraphics 1290SYS"OS_GBPB",9,"<Draughts$Dir>.Graphics",block%,256,0,8192,0 TO ,,,ngrfiles 1300offset=0 1310FOR f=1TO ngrfiles 1320f$="" 1330REPEAT 1340f$+=CHR$(block%?offset) 1350offset+=1 1360UNTIL block%?offset =0 1370offset+=1 1380graphic$(f)=f$ 1390NEXT 1400pane%!44=-(56*ngrfiles) 1410IF ngrfiles<3 THEN pane%!44=-156 1420SYS"Wimp_CreateWindow",,pane% TO pane_handle% 1430FOR f=1TO ngrfiles 1440PROCalterIcon(pane_handle%,f-1,"#"+graphic$(f),0,1) 1450NEXT 1460ENDPROC 1470 1480DEFPROCloadfile_startedwith 1490SYS"OS_GetEnv" TO env$ 1500env$=MID$(env$,INSTR(env$,"""",INSTR(env$,"""")+1)+1) 1510WHILE LEFT$(env$,1)=" " 1520env$=MID$(env$,2) 1530ENDWHILE 1540firstload=TRUE 1550PROCload(env$) 1560firstload=FALSE 1570ENDPROC 1580 1590DEFPROCstore 1600FOR s=0TO31 1610store?((pos*44)+s)=square(numsq(s)) 1620NEXT 1630FOR h=0 TO 10 1640store?((pos*44)+h+32)=huff(h) 1650NEXT 1660store?((pos*44)+43)=phuff 1670pos+=1 1680ENDPROC 1690 1700DEFPROCrestoreboard(rpos) 1710FOR s=0TO31 1720IF square(numsq(s))<>store?((rpos*44)+s) OR indim=TRUE THEN PROCsetpiece(numsq(s),store?((rpos*44)+s)) 1730square(numsq(s))=store?((rpos*44)+s) 1740NEXT 1750PROCcountmen 1760ENDPROC 1770 1780DEFPROCrestore(rpos) 1790SYS"Hourglass_On" 1800pos=rpos+1 1810PROCrestoreboard(rpos) 1820FOR h=0 TO 10 1830huff(h)=store?((rpos*44)+32+h) 1840NEXT 1850phuff=store?((rpos*44)+43) 1860IF (pos AND 1) THEN Go=1:Ogo=2 ELSE Go=2:Ogo=1 1870PROCsetgotext 1880PROCcheckifhuff 1890PROCungreymenu(TRUE,TRUE,TRUE) 1900SYS"Hourglass_Off" 1910ENDPROC 1920 1930DEFPROCsetgotext 1940PROCsetgoicon(TRUE) 1950IF Go=1 THEN Go$=Plyr1$ ELSE Go$=Plyr2$ 1960IF RIGHT$(Go$,1)="s" THEN Go$+="' turn" ELSE Go$+="'s turn" 1970PROCalterIcon(main_handle%,Gotexticon,"!"+Go$,0,1) 1980ENDPROC 1990 2000DEFPROCcountmen 2010m1=0:m2=0:k3=0:k4=0 2020FOR s=0 TO 63 2030CASE square(s) OF 2040WHEN 1:m1+=1 2050WHEN 2:m2+=1 2060WHEN 3:k3+=1 2070WHEN 4:k4+=1 2080ENDCASE 2090NEXT 2100PROCalterIcon(main_handle%,m1_icon,"#"+STR$m1,0,1) 2110PROCalterIcon(main_handle%,m2_icon,"#"+STR$m2,0,1) 2120PROCalterIcon(main_handle%,k3_icon,"#"+STR$k3,0,1) 2130PROCalterIcon(main_handle%,k4_icon,"#"+STR$k4,0,1) 2140ENDPROC 2150 2160DEFPROCsetpiece(piecen,piece) 2170IF dimension=2 THEN 2180PROCalterIcon(main_handle%,piecen,"#square"+STR$piece+"9",0,1) 2190ELSE 2200PROCalterIcon(main_handle%,piecen+65,"#",0,1) 2210row=FNrow(piecen) 2220!block%=main_handle%:block%!4=piecen+65 2230SYS"Wimp_GetIconState",,block% 2240SYS"Wimp_DeleteIcon",,block% 2250piecegn=(piece*10)+row 2260grx=grsizes(0,piecegn) 2270gry=grsizes(1,piecegn) 2280block%!4=main_handle% 2290block%!8=xcoord(piecen)-(grx/2) 2300block%!12=ycoord(row)+4 2310block%!16=block%!8+grx 2320block%!20=block%!12+gry 2330block%!24=&301A 2340$(block%+28)="square"+STR$piecegn 2350SYS"Wimp_CreateIcon",,block%+4 2360SYS"Wimp_ForceRedraw",main_handle%,block%!8,block%!12,block%!16,block%!20 2370ENDIF 2380ENDPROC 2390 2400DEFPROCsetpieceflags(piecen,flags) 2410PROCalterIcon(main_handle%,piecen,"",flags,1) 2420ENDPROC 2430 2440DEFPROCload(loadname$) 2450inload=TRUE 2460SYS"Hourglass_On" 2470A%=OPENINloadname$ 2480dimension=BGET#A% 2490GoI=BGET#A% 2500Plyr1=BGET#A% 2510Plyr2=BGET#A% 2520level%=BGET#A% 2530grld$="" 2540FOR g=0 TO 9 2550grld$+=CHR$(BGET#A%) 2560NEXT 2570g=INSTR(grld$,".") 2580IF g>0 THEN grld$=LEFT$(grld$,g-1) 2590pos=BGET#A% 2600FOR p=0 TO (pos*44)-1 2610store?p=BGET#A% 2620NEXT 2630CLOSE#A% 2640PROCsetgraphics(grld$) 2650PROCalterIcon(players_handle%,18,"#"+STR$level%,0,1) 2660IF instep=TRUE THEN spos=pos-1:PROCclick(4,stepthru_handle%,4):PROCclick(4,stepthru_handle%,2) 2670IF firstload=FALSE THEN bdimen=dimension:dimension=0:PROCsetdimension(bdimen) 2680IF GoI>2 THEN 2690Go=GoI-2 2700IF Go=1 THEN Ogo=2 ELSE Ogo=1 2710PROCconcede 2720ELSE 2730Go=GoI 2740IF Go=1 THEN Ogo=2 ELSE Ogo=1 2750ENDIF 2760IF firstload=FALSE THEN filename$=loadname$:PROCalterIcon(save_handle%,10,"!"+filename$,0,1) 2770SYS"Hourglass_Off" 2780inload=FALSE 2790ENDPROC 2800 2810DEFPROCsetdimension(newdimens) 2820IF dimension=newdimens THEN ENDPROC 2830!block%=main_handle%:SYS"Wimp_GetWindowState",,block% 2840infront=block%!28 2850dimension=newdimens 2860!block%=main_handle% 2870SYS"Wimp_DeleteWindow",,block% 2880IF dimension=2 THEN 2890SYS"Wimp_CreateWindow",,main2% TO main_handle% 2900PROCvars2d 2910dimenm!28=1:dimenm!52=&80 2920ELSE 2930SYS"Wimp_CreateWindow",,main3% TO main_handle% 2940PROCvars3d 2950dimenm!28=0:dimenm!52=&81 2960ENDIF 2970indim=TRUE 2980PROCrestore(pos-1) 2990indim=FALSE 3000IF Plyr1=0 THEN MPlyr1$="User" ELSE MPlyr1$="Archie" 3010IF Plyr2=0 THEN MPlyr2$="User" ELSE MPlyr2$="Archie" 3020PROCalterIcon(main_handle%,mplayer1,"#"+MPlyr1$,0,1) 3030PROCalterIcon(players_handle%,3,"#"+MPlyr1$,0,1) 3040PROCalterIcon(main_handle%,mplayer2,"#"+MPlyr2$,0,1) 3050PROCalterIcon(players_handle%,7,"#"+MPlyr2$,0,1) 3060IF First<>-1 THEN PROCsetpieceflags(First,red) 3070IF nint>0 THEN 3080FOR i=1TOnint 3090PROCsetpieceflags(int(i),green) 3100NEXT 3110ENDIF 3120PROCsetplyrnames 3130PROCcountmen:PROCcheckifwon 3140IF conceded PROCconcede 3150IF mainopen THEN 3160!block%=main_handle% 3170SYS"Wimp_GetWindowState",,block% 3180block%!28=infront 3190SYS"Wimp_OpenWindow",,block% 3200ENDIF 3210ENDPROC 3220 3230DEFPROCopenwindow(handle%) 3240IF handle%=main_handle% THEN mainopen=TRUE 3250!block%=handle% 3260SYS"Wimp_GetWindowState",,block% 3270SYS"Wimp_OpenWindow",,block% 3280ENDPROC 3290 3300DEFPROCsetgoicon(thinking) 3310IF playing%=FALSE THEN PROCalterIcon(main_handle%,goicon,"#",0,1):ENDPROC 3320IF thinking THEN 3330IF Go=1 AND Plyr1=0 THEN ic$="cm3" 3340IF Go=1 AND Plyr1=1 THEN ic$="cm1" 3350IF Go=2 AND Plyr2=0 THEN ic$="cm3" 3360IF Go=2 AND Plyr2=1 THEN ic$="cm1" 3370ENDIF 3380IF thinking=FALSE THEN 3390IF Go=1 AND Plyr1=0 THEN ic$="cm4" 3400IF Go=1 AND Plyr1=1 THEN ic$="cm2" 3410IF Go=2 AND Plyr2=0 THEN ic$="cm4" 3420IF Go=2 AND Plyr2=1 THEN ic$="cm2" 3430ENDIF 3440PROCalterIcon(main_handle%,goicon,"#"+ic$,0,1) 3450ENDPROC 3460 3470DEFPROCsetgraphics(grld$) 3480lgrld=0 3490FOR g=1 TO ngrfiles 3500IF graphic$(g)=grld$ THEN lgrld=g 3510NEXT 3520REM **** lgrld=2 **** 3530PROCpanemove(lgrld) 3540PROCclick(4,pane_handle%,lgrld-1) 3550PROCclick(4,graphics_handle%,6) 3560ENDPROC 3570 3580DEFPROCgrclicked(icon%) 3590IF icon%>-1 AND icon%<ngrfiles THEN 3600PROCalterIcon(pane_handle%,grblacked-1,"",&17006039,1) 3610grblacked=icon%+1 3620PROCalterIcon(pane_handle%,grblacked-1,"",&70006039,1) 3630ENDIF 3640ENDPROC 3650 3660DEFPROCpanemove(whereto) 3670!block%=pane_handle% 3680SYS"Wimp_GetWindowState",,block% 3690block%!24=40*(whereto-1) 3700IF inload=FALSE THEN SYS"Wimp_OpenWindow",,block% 3710ENDPROC 3720 3730 3740DEFPROCjustmoved 3750IF Go=1 THEN Go=2:Ogo=1 ELSE Go=1:Ogo=2 3760huff()=nhuff() 3770phuff=nphuff 3780PROCstore 3790PROCcheckifhuff 3800IF playing% THEN PROCsetgotext 3810First=-1:Second=-1 3820ENDPROC 3830 3840DEFPROCclick(button%,window%,icon%) 3850IF button%=2 THEN PROCmenucreate(window%):ENDPROC 3860IF window%=-2 AND button%=4 THEN PROCopenwindow(main_handle%) 3870IF window%=save_handle% THEN 3880IF icon%=0 THEN PROCstartdrag 3890IF icon%=9 THEN 3900IF button%=1 THEN iconclicked=TRUE 3910PROCsave(FNgettext(save_handle%,10)) 3920iconclicked=FALSE 3930ENDIF 3940ENDIF 3950IF window%=pane_handle% THEN 3960PROCgrclicked(icon%) 3970ENDIF 3980IF window%=graphics_handle% THEN 3990IF icon%=6 THEN 4000IF grblacked<>loaded OR firstload=TRUE THEN 4010lgrld=grblacked 4020PROCloadgraphics("<Draughts$Dir>.Graphics."+graphic$(lgrld)) 4030ENDIF 4040IF button%=4 THEN !block%=graphics_handle%:PROCclose 4050ENDIF 4060ENDIF 4070IF window%=players_handle% THEN 4080IF icon%=3 OR icon%=7 THEN 4090IF icon%=3 THEN Plyr1p=Plyr1p EOR 1 4100IF icon%=7 THEN Plyr2p=Plyr2p EOR 1 4110IF Plyr1p=0 THEN P1$="User" ELSE P1$="Archie" 4120IF Plyr2p=0 THEN P2$="User" ELSE P2$="Archie" 4130IF icon%=3 THEN 4140PROCalterIcon(players_handle%,3,"#"+P1$,0,1) 4150ELSE 4160PROCalterIcon(players_handle%,7,"#"+P2$,0,1) 4170ENDIF 4180ENDIF 4190IF button%=1 AND icon%=19 THEN icon%=20:button%=4 4200IF button%=1 AND icon%=20 THEN icon%=19:button%=4 4210IF icon%=19 AND levelp%>1 THEN levelp%-=1:PROCalterIcon(players_handle%,18,"#"+STR$levelp%,0,1) 4220IF icon%=20 AND levelp%<ld THEN levelp%+=1:PROCalterIcon(players_handle%,18,"#"+STR$levelp%,0,1) 4230IF icon%=26 THEN 4240level%=levelp% 4250Plyr1=Plyr1p:Plyr2=Plyr2p 4260IF Go=1 AND Plyr1=0 THEN incomp=FALSE 4270IF Go=2 AND Plyr2=0 THEN incomp=FALSE 4280IF Plyr1=0 THEN P1$="User" ELSE P1$="Archie" 4290IF Plyr2=0 THEN P2$="User" ELSE P2$="Archie" 4300PROCalterIcon(main_handle%,mplayer1,"#"+P1$,0,1) 4310PROCalterIcon(main_handle%,mplayer2,"#"+P2$,0,1) 4320IF button%=4 THEN SYS"Wimp_CreateMenu",,-1 4330ENDIF 4340ENDIF 4350IF window%=stepthru_handle% AND icon% <5 THEN 4360PROCstepthru(icon%) 4370ENDIF 4380IF window%=main_handle% AND playing%=TRUE AND incomp=FALSE AND instep=FALSE THEN 4390ok=FALSE 4400IF dimension=2 AND icon%<64 THEN ok=TRUE 4410IF dimension=3 AND icon%<129 THEN ok=TRUE 4420IF ok THEN 4430IF dimension=3 THEN PROCfindoutwhich 4440IF icon%<64 AND icon%>-1 THEN PROCboardclick(icon%) 4450ENDIF 4460ENDIF 4470ENDPROC 4480 4490DEFPROCsetupmenus 4500DIM mainm 520,barm 520,miscm 520,dimenm 520,huffm 520,canchm 520,cancfm 520 4510menu=mainm 4520$menu="Draughts":menu!12=&70207:menu!16=204:menu!20=44:menu!24=0:menu+=28 4530menu!0=0:menu!4=miscm:menu!8=&7000021:$(menu+12)="Misc" 4540menu!24=0:menu!28=-1:menu!32=&7000021:$(menu+36)="Step thru..." 4550menu!48=8:menu!52=players_handle%:menu!56=&7000021:$(menu+60)="Players" 4560menu!72=0:menu!76=-1:menu!80=&7000021:$(menu+84)="Graphics..." 4570menu!96=2:menu!100=dimenm:menu!104=&7000021:$(menu+108)="Board" 4580menu!120=0:menu!124=huffm:menu!128=&7000021:$(menu+132)="Huff" 4590menu!144=0:menu!148=-1:menu!152=&7000021:$(menu+156)="Concede" 4600menu!168=&80:menu!172=-1:menu!176=&7000021:$(menu+180)="New game" 4610menu=barm 4620$menu="Draughts":menu!12=&70207:menu!16=120:menu!20=44:menu!24=0:menu+=28 4630menu!0=0:menu!4=info_handle%:menu!8=&7000021:$(menu+12)="Info" 4640menu!24=8:menu!28=save_handle%:menu!32=&7000021:$(menu+36)="Save" 4650menu!48=&80:menu!52=-1:menu!56=&7000021:$(menu+60)="Quit" 4660menu=miscm 4670$menu="Misc":menu!12=&70207:menu!16=96:menu!20=44:menu!24=0:menu+=28 4680menu!0=0:menu!4=info_handle%:menu!8=&7000021:$(menu+12)="Info" 4690menu!24=&88:menu!28=save_handle%:menu!32=&7000021:$(menu+36)="Save" 4700menu=dimenm 4710$menu="Board":menu!12=&70207:menu!16=208:menu!20=44:menu!24=0:menu+=28 4720menu!0=0:menu!4=-1:menu!8=&7000021:$(menu+12)="2 dimensions" 4730menu!24=&80:menu!28=-1:menu!32=&7000021:$(menu+36)="3 dimensions" 4740menu=huffm 4750$menu="Huff":menu!12=&70207:menu!16=100:menu!20=44:menu!24=0:menu+=28 4760menu!0=0:menu!4=-1:menu!8=&7000021:$(menu+12)="Huff" 4770menu!24=&80:menu!28=-1:menu!32=&7000021:$(menu+36)="Force" 4780menu=canchm 4790$menu="Huff":menu!12=&70207:menu!16=112:menu!20=44:menu!24=0:menu+=28 4800menu!0=&80:menu!4=-1:menu!8=&7000021:$(menu+12)="Cancel" 4810menu=cancfm 4820$menu="Force":menu!12=&70207:menu!16=112:menu!20=44:menu!24=0:menu+=28 4830menu!0=&80:menu!4=-1:menu!8=&7000021:$(menu+12)="Cancel" 4840ENDPROC 4850 4860DEFPROCmenucreate(window%) 4870mencr%=window% 4880IF mencr%<>-2 AND mencr%<>main_handle% THEN ENDPROC 4890IF mencr%=-2 THEN SYS"Wimp_CreateMenu",,barm,block%!0-64,228 4900IF mencr%=main_handle% THEN SYS"Wimp_CreateMenu",,mainm,block%!0-64,block%!4+16 4910ENDPROC 4920 4930DEFFNgettext(window%,icon%) 4940!block2%=window%:block2%!4=icon%:SYS"Wimp_GetIconState",,block2% 4950IF (block2%!24 AND 256)=256 THEN :=$(block2%!28) ELSE :=$(block2%+28) 4960 4970DEFPROCslotsize(newslot) 4980SYS"Wimp_SlotSize",newslot,-1 TO nslot 4990ENDPROC 5000 5010DEFPROCstepthru(icon%) 5020IF icon%=0 THEN steppos=0:PROCrestore(steppos) 5030IF icon%=4 THEN steppos=spos:PROCrestore(steppos) 5040IF icon%=1 AND steppos>0 THEN steppos-=1:PROCrestore(steppos) 5050IF icon%=3 AND steppos<spos THEN steppos+=1:PROCrestore(steppos) 5060IF icon%=2 THEN 5070!block%=stepthru_handle%:PROCclose 5080instep=FALSE:playing%=TRUE 5090conceded=FALSE 5100PROCrestore(steppos):PROCcheckifhuff 5110ENDIF 5120ENDPROC 5130 5140DEFPROCfindoutwhich 5150IF icon%=64 AND FNclicksquare THEN PROCfindoutreal 5160IF icon%>64 AND FNclicksquare THEN PROCfindoutreal 5170IF icon%>64 THEN icon%-=65 5180ENDPROC 5190 5200DEFFNclicksquare 5210SYS"Wimp_GetPointerInfo",,block% 5220mxco=!block%:myco=block%!4 5230SYS"OS_ReadModeVariable",-1,3 TO ,,coll 5240IF POINT(mxco,myco)=FNmodecol1 THEN :=TRUE 5250IF POINT(mxco,myco)=FNmodecol2 THEN :=TRUE 5260IF POINT(mxco,myco)=FNmodecol3 THEN :=TRUE 5270=FALSE 5280 5290DEFFNmodecol1 5300IF coll=1 THEN :=1 5310IF coll=3 THEN :=3 5320IF coll=15 THEN :=7 5330IF coll=63 THEN :=0 5340=FALSE 5350 5360DEFFNmodecol2 5370IF coll=1 THEN :=1 5380IF coll=3 THEN :=3 5390IF coll=15 THEN :=11 5400IF coll=63 THEN :=3 5410=FALSE 5420 5430DEFFNmodecol3 5440IF coll=1 THEN :=1 5450IF coll=3 THEN :=2 5460IF coll=15 THEN :=10 5470IF coll=63 THEN :=12 5480=FALSE 5490 5500DEFPROCfindoutreal 5510SYS"Wimp_GetPointerInfo",,block% 5520mxco=block%!0:myco=block%!4 5530!block%=main_handle% 5540SYS"Wimp_GetWindowState",,block% 5550scrllx=block%!20:scrlly=block%!24 5560mxco=mxco+(scrllx-block%!4) 5570myco=myco+(scrlly-block%!16) 5580found=0:counter=0 5590REPEAT 5600counter+=1 5610IF mxco>sqsizes(0,counter) AND mxco<sqsizes(2,counter) AND myco>sqsizes(1,counter) AND myco<sqsizes(3,counter) THEN found=counter 5620UNTIL found<>0 OR counter=63 5630IF found<>0 THEN icon%=found 5640IF icon%=64 THEN icon%=0 5650IF icon%>64 THEN icon%-=65 5660ENDPROC 5670 5680DEFPROCboardclick(icon%) 5690IF button%=1 AND First<>-1 THEN PROCinter(icon%):ENDPROC 5700IF button%=1 THEN ENDPROC 5710IF icon%=First AND First<>-1 THEN First=-1:PROCsetpieceflags(icon%,black):PROCclearint:ENDPROC 5720IF First=-1 AND (square(icon%)=Go OR square(icon%)=Go+2) THEN First=icon%:PROCsetpieceflags(icon%,red):ENDPROC 5730IF First<>-1 AND square(icon%)=0 THEN 5740Second=icon% 5750IF FNlegal THEN PROCmove 5760ENDIF 5770ENDPROC 5780 5790DEFPROCinter(icon%) 5800int(0)=First:lint=int(nint) 5810IF nint>0 AND icon%=lint THEN PROCunint(icon%):ENDPROC 5820set=FALSE 5830IF square(First)>2 THEN d1=TRUE:d2=TRUE 5840IF square(First)=1 THEN d1=TRUE:d2=FALSE 5850IF square(First)=2 THEN d1=FALSE:d2=TRUE 5860IF square(icon%)=0 THEN 5870IF icon%=lint-14 AND FNrow(icon%)+2 = FNrow(lint) AND d1=TRUE THEN 5880IF FNopp(lint-7) THEN set=TRUE 5890ENDIF 5900IF icon%=lint-18 AND FNrow(icon%)+2 = FNrow(lint) AND d1=TRUE THEN 5910IF FNopp(lint-9) THEN set=TRUE 5920ENDIF 5930IF icon%=lint+14 AND FNrow(icon%)-2 = FNrow(lint) AND d2=TRUE THEN 5940IF FNopp(lint+7) THEN set=TRUE 5950ENDIF 5960IF icon%=lint+18 AND FNrow(icon%)-2 = FNrow(lint) AND d2=TRUE THEN 5970IF FNopp(lint+9) THEN set=TRUE 5980ENDIF 5990ENDIF 6000IF set THEN 6010PROCsetpieceflags(icon%,green) 6020nint+=1 6030int(nint)=icon% 6040ENDIF 6050ENDPROC 6060 6070DEFPROCclearint 6080IF nint>0 THEN 6090FOR i=1 TO nint 6100PROCsetpieceflags(int(i),black) 6110NEXT 6120ENDIF 6130nint=0:int()=0 6140ENDPROC 6150 6160DEFPROCunint(icon%) 6170PROCsetpieceflags(icon%,black) 6180int(nint)=0 6190nint-=1 6200ENDPROC 6210 6220DEFFNlegal 6230IF square(First)>2 THEN d1=TRUE:d2=TRUE 6240IF square(First)=1 THEN d1=TRUE:d2=FALSE 6250IF square(First)=2 THEN d1=FALSE:d2=TRUE 6260ok=FALSE 6270IF nint=0 THEN 6280IF inforce=FALSE THEN 6290 6300IF Second-First=-7 AND d1=TRUE AND FNrow(Second)+1 = FNrow(First) THEN ok=TRUE 6310IF Second-First=-9 AND d1=TRUE AND FNrow(Second)+1 = FNrow(First) THEN ok=TRUE 6320IF Second-First=7 AND d2=TRUE AND FNrow(Second)-1 = FNrow(First) THEN ok=TRUE 6330IF Second-First=9 AND d2=TRUE AND FNrow(Second)-1 = FNrow(First) THEN ok=TRUE 6340ENDIF 6350 6360: 6370IF Second-First=-14 AND d1=TRUE AND FNrow(Second)+2 = FNrow(First) AND FNopp(Second+7) THEN PROCdeleteopp(Second+7):ok=TRUE 6380IF Second-First=-18 AND d1=TRUE AND FNrow(Second)+2 = FNrow(First) AND FNopp(Second+9) THEN PROCdeleteopp(Second+9):ok=TRUE 6390IF Second-First=14 AND d2=TRUE AND FNrow(Second)-2 = FNrow(First) AND FNopp(Second-7) THEN PROCdeleteopp(Second-7):ok=TRUE 6400IF Second-First=18 AND d2=TRUE AND FNrow(Second)-2 = FNrow(First) AND FNopp(Second-9) THEN PROCdeleteopp(Second-9):ok=TRUE 6410ENDIF 6420IF ok=TRUE THEN :=TRUE 6430IF nint=0 THEN :=0 6440ok=FALSE 6450IF Second-int(nint)=-14 AND d1=TRUE AND FNrow(Second)+2 = FNrow(int(nint)) AND FNopp(Second+7) THEN PROCdeleteopp(Second+7):ok=TRUE 6460IF Second-int(nint)=-18 AND d1=TRUE AND FNrow(Second)+2 = FNrow(int(nint)) AND FNopp(Second+9) THEN PROCdeleteopp(Second+9):ok=TRUE 6470IF Second-int(nint)=14 AND d2=TRUE AND FNrow(Second)-2 = FNrow(int(nint)) AND FNopp(Second-7) THEN PROCdeleteopp(Second-7):ok=TRUE 6480IF Second-int(nint)=18 AND d2=TRUE AND FNrow(Second)-2 = FNrow(int(nint)) AND FNopp(Second-9) THEN PROCdeleteopp(Second-9):ok=TRUE 6490IF ok=FALSE THEN :=0 6500FOR i=1 TO nint 6510IF int(i)-int(i-1)=-14 AND d1=TRUE THEN PROCdeleteopp(int(i)+7) 6520IF int(i)-int(i-1)=-18 AND d1=TRUE THEN PROCdeleteopp(int(i)+9) 6530IF int(i)-int(i-1)=14 AND d2=TRUE THEN PROCdeleteopp(int(i)-7) 6540IF int(i)-int(i-1)=18 AND d2=TRUE THEN PROCdeleteopp(int(i)-9) 6550NEXT 6560PROCclearint 6570=TRUE 6580 6590DEFFNopp(opchk) 6600IF opchk<0 OR opchk>63 THEN :=FALSE 6610IF square(opchk)=Ogo OR square(opchk)=Ogo+2 THEN :=TRUE 6620=FALSE 6630 6640DEFPROCdeleteopp(delcon) 6650square(delcon)=0 6660IF thicondone=FALSE THEN 6670PROCsetgoicon(FALSE):PROCpoll 6680IF finished% THEN PROCend 6690thicondone=TRUE 6700ENDIF 6710nphuff=FALSE 6720PROCsetpiece(delcon,0) 6730ENDPROC 6740 6750DEFPROCmove 6760IF thicondone=FALSE THEN 6770PROCsetgoicon(FALSE):PROCpoll 6780IF finished% THEN PROCend 6790ENDIF 6800IF Go=1 AND Second<8 THEN square(First)=3 6810IF Go=2 AND Second>55 THEN square(First)=4 6820square(Second)=square(First) 6830square(First)=0 6840PROCsetpiece(First,0) 6850PROCsetpieceflags(First,black) 6860PROCsetpiece(Second,square(Second)) 6870PROCsetpieceflags(Second,black) 6880thicondone=FALSE 6890FOR h=0TOnphuff-1 6900IF First=nhuff(h) THEN nhuff(h)=Second 6910NEXT 6920PROCcountmen 6930PROCjustmoved 6940IF inforce THEN fdone=TRUE 6950ENDPROC 6960 6970DEFPROCsetupvarsndims 6980conceded=FALSE 6990indim=FALSE 7000incomp=FALSE 7010iconclicked=FALSE 7020phuff=0:nphuff=0 7030nint=0 7040hffd=FALSE 7050inforce=FALSE 7060inhuff=FALSE 7070mainopen=FALSE 7080finished%=FALSE 7090instep=FALSE 7100thicondone=FALSE 7110Plyr1=0:Plyr2=0:level%=1 7120pos=0:grld=0:playing%=TRUE 7130First=-1:Second=-1 7140dimension=0 7150Go=1:Ogo=2:Plyr1$="":Plyr2$="" 7160ld=5 7170DIM xcoord(63),ycoord(8) 7180DIM square(63),graphic$(255),numsq(31) 7190DIM store 16384,huff(11),grsizes(1,64),nhuff(11),sqsizes(3,63) 7200DIM int(12) 7210DIM quad(ld,12,63),bestpos(63),piece(ld),lev(ld),bscore(ld),score(ld) 7220DIM bestpos2(63) 7230DIM d1(ld),d2(ld),king(ld,12),maxlev(ld),oldnj(ld,12),nj(ld,12) 7240DIM pjump(ld),tempscore(ld),pmove(ld) 7250loaded=0 7260ENDPROC 7270 7280DEFPROCvars3d 7290black=&77000038 7300red=&B7000038 7310green=&A7000038 7320yellow=&97000038 7330mplayer1=134:mplayer2=137 7340pcname1=133:pcname2=136 7350goicon=158 7360m1_icon=150:m2_icon=151 7370k3_icon=152:k4_icon=153 7380Gotexticon=157 7390ENDPROC 7400 7410DEFPROCvars2d 7420black=&7700303A 7430red=&B700303A 7440green=&A700303A 7450yellow=&9700303A 7460mplayer1=71:mplayer2=73 7470pcname1=68:pcname2=70 7480goicon=72 7490m1_icon=96:m2_icon=98 7500k3_icon=97:k4_icon=99 7510Gotexticon=95 7520ENDPROC 7530 7540DEFPROCcheckifwon 7550IF m1=0 AND k3=0 THEN 7560playing%=FALSE 7570IF RIGHT$(Plyr2$,1)="s" THEN won$="!"+Plyr2$+" have won!" ELSE won$="!"+Plyr2$+" has won!" 7580PROCalterIcon(main_handle%,Gotexticon,won$,0,1) 7590ENDIF 7600IF m2=0 AND k4=0 THEN 7610playing%=FALSE 7620IF RIGHT$(Plyr1$,1)="s" THEN won$="!"+Plyr1$+" have won!" ELSE won$="!"+Plyr1$+" has won!" 7630PROCalterIcon(main_handle%,Gotexticon,won$,0,1) 7640ENDIF 7650IF playing%=FALSE THEN PROCgreymenu(0,TRUE,TRUE):PROCalterIcon(main_handle%,goicon,"#",0,1) 7660ENDPROC 7670 7680DEFPROCgreymenu(gr1,gr2,gr3) 7690IF gr1 THEN mainm!60=&7400021 7700IF gr2 THEN mainm!156=&7400021 7710IF gr3 THEN mainm!180=&7400021 7720ENDPROC 7730 7740DEFPROCkeypressed(window%,icon%,key%) 7750IF window%=save_handle% AND icon%=10 AND key%=13 THEN 7760PROCsave(FNgettext(save_handle%,10)) 7770ELSE 7780SYS"Wimp_ProcessKey",key% 7790ENDIF 7800ENDPROC 7810 7820DEFPROCdecodemenu 7830c=FALSE 7840closeit=FALSE 7850IF mencr%=-2 AND block%!0=2 THEN finished%=TRUE 7860IF mencr%=main_handle% THEN 7870IF block%!0=1 THEN 7880c=TRUE 7890closeit=TRUE 7900PROCgreymenu(TRUE,TRUE,TRUE) 7910steppos=pos-1 7920spos=pos-1 7930instep=TRUE 7940incomp=FALSE 7950playing%=FALSE:PROCsetgoicon(FALSE) 7960PROCopenwindow(stepthru_handle%) 7970ENDIF 7980IF c=0 AND block%!0=3 THEN PROCopengraphics:c=TRUE 7990IF c=0 AND block%!0=4 AND block%!4=0 THEN PROCsetdimension(2):c=TRUE 8000IF c=0 AND block%!0=4 AND block%!4=1 THEN PROCsetdimension(3):c=TRUE 8010IF c=0 AND block%!0=5 AND block%!4=0 AND phuff<>0 THEN PROChuff:hffd=TRUE:c=TRUE 8020IF c=0 AND block%!0=5 AND block%!4=1 AND phuff<>0 THEN PROCforce:hffd=TRUE:c=TRUE 8030IF c=0 AND block%!0=6 THEN PROCconcede:c=TRUE 8040IF c=0 AND block%!0=7 THEN PROCnewgame:c=TRUE 8050ENDIF 8060IF hffd THEN hffd=FALSE:ENDPROC 8070SYS"Wimp_GetPointerInfo",,block% 8080IF block%!8=1 AND closeit=FALSE THEN 8090PROCmenucreate(mencr%) 8100ENDIF 8110ENDPROC 8120 8130DEFPROCmessage 8140CASE block%!16 OF 8150WHEN 0:finished%=TRUE 8160WHEN 2:PROCsave(FNtidy(block%+44)) 8170WHEN 3:IF block%!12=0 AND block%!40=&560 THEN PROCload(FNtidy(block%+44)) 8180WHEN &502:PROChelp 8190WHEN &400C0: 8200IF (mencr%=main_handle% AND block%!32=0 AND block%!36=1) THEN PROCopensave 8210IF (mencr%=-2 AND block%!32=1) THEN PROCopensave 8220IF (mencr%=main_handle% AND block%!32=2) THEN PROCopenplayers 8230ENDCASE 8240ENDPROC 8250 8260DEFPROCopengraphics 8270!block%=graphics_handle% 8280SYS"Wimp_GetWindowState",,block% 8290xoffset=block%!4:yoffset=block%!8 8300!block%=pane_handle% 8310SYS"Wimp_GetWindowState",,block% 8320block%!4=xoffset+16 8330block%!8=yoffset+88 8340block%!12=block%!4+204 8350block%!16=block%!8+156 8360SYS"Wimp_OpenWindow",,block% 8370!block%=graphics_handle% 8380SYS"Wimp_GetWindowState",,block% 8390block%!28=pane_handle% 8400SYS"Wimp_OpenWindow",,block% 8410PROCgrclicked(lgrld-1) 8420PROCpanemove(lgrld) 8430ENDPROC 8440 8450DEFPROCopen 8460IF !block%=graphics_handle% THEN 8470xoffset=block%!4:yoffset=block%!8 8480xoffset2=block%!12:yoffset2=block%!16 8490!block%=pane_handle% 8500SYS"Wimp_GetWindowState",,block% 8510block%!4=xoffset+16 8520block%!8=yoffset+88 8530block%!12=block%!4+204 8540block%!16=block%!8+156 8550SYS"Wimp_OpenWindow",,block% 8560!block%=graphics_handle% 8570SYS"Wimp_GetWindowState",,block% 8580block%!4=xoffset:block%!8=yoffset 8590block%!12=xoffset2:block%!16=yoffset2 8600block%!28=pane_handle% 8610SYS"Wimp_OpenWindow",,block% 8620ELSE 8630SYS"Wimp_OpenWindow",,block% 8640ENDIF 8650ENDPROC 8660 8670DEFPROCclose 8680IF !block%=main_handle% THEN mainopen=FALSE 8690IF !block%=graphics_handle% THEN 8700SYS"Wimp_CloseWindow",,block% 8710!block%=pane_handle% 8720ENDIF 8730SYS"Wimp_CloseWindow",,block% 8740ENDPROC 8750 8760DEFPROCsetplyrnames 8770PROCalterIcon(main_handle%,pcname1,"#"+Plyr1$,0,1) 8780PROCalterIcon(main_handle%,pcname2,"#"+Plyr2$,0,1) 8790ENDPROC 8800 8810DEFFNrow(rch) 8820IF rch<0 THEN :=rch+100 8830rch=(rch DIV 8) +1 8840IF rch>0 AND rch<9 THEN :=rch 8850=(rch+100) 8860 8870DEF PROCalterIcon(whandle%,ihandle%,text$,flgs%,redraw) 8880block%!0=whandle%:block%!4=ihandle%:SYS"Wimp_GetIconState",,block% 8890IF LEFT$(text$,1)="!" THEN 8900$block%!28=RIGHT$(text$,LEN(text$)-1) 8910ENDIF 8920IF LEFT$(text$,1)="#" THEN 8930$(block%+28)=RIGHT$(text$,LEN(text$)-1) 8940IF flgs%=0 THEN SYS"Wimp_DeleteIcon",,block%:block%!4=whandle%:SYS"Wimp_CreateIcon",,block%+4 8950ENDIF 8960IF flgs%<>0 THEN 8970SYS"Wimp_DeleteIcon",,block% 8980block%!24=flgs% 8990block%!4=whandle% 9000SYS"Wimp_CreateIcon",,block%+4 9010ENDIF 9020IF redraw=0 THEN ENDPROC 9030SYS"Wimp_ForceRedraw",whandle%,block%!8,block%!12,block%!16,block%!20 9040ENDPROC 9050 9060DEFPROCungreymenu(gr1,gr2,gr3) 9070IF gr1 THEN mainm!60=&7000021 9080IF gr2 THEN mainm!156=&7000021 9090IF gr3 THEN mainm!180=&7000021 9100ENDPROC 9110 9120 9130DEFFNtidy(loc%) 9140tidy$="" 9150REPEAT 9160tidy$+=CHR$(?loc%) 9170loc%+=1 9180UNTIL ?loc%<32 9190=tidy$ 9200DEFPROCloadgraphics(grfile$) 9210IF grfile$="" THEN ENDPROC 9220A%=OPENINgrfile$ 9230present=A% 9240lensp=EXT#A%:lensp+=((lensp-69000)*9) 9250CLOSE#A% 9260IF present=0 THEN PROCerror("Unable to load graphics file - perhaps the Draughts disc is not present",FALSE):!block%=graphics_handle%:PROCclose:ENDPROC 9270SYS"Hourglass_On" 9280IF inload=FALSE THEN 9290SYS"XOS_SpriteOp",256+25,sprites%,"board" 9300FORa=1TO4 9310FORb=0TO9 9320SYS"XOS_SpriteOp",256+25,sprites%,"square"+STR$a+STR$b 9330NEXT:NEXT 9340ENDIF 9350PROCslotsize(slotsize+lensp) 9360IF nslot<(slotsize+lensp) THEN 9370PROCerror("Unable to allocate sufficient memory for graphics file - approximately "+STR$(lensp DIV 1024)+"k is needed.",0) 9380IF inload=TRUE AND firstload=TRUE THEN PROCend 9390ENDIF 9400IF nslot<(slotsize+lensp) THEN PROCslotsize(slotsize):ENDPROC 9410!sprites%+=lensp 9420SYS"OS_SpriteOp",267,sprites%,grfile$ 9430SYS"OS_SpriteOp",256+13,sprites%,block%,256,17 9440Plyr1$=FNtidy(block%) 9450SYS"OS_SpriteOp",256+13,sprites%,block%,256,18 9460Plyr2$=FNtidy(block%) 9470SYS"OS_SpriteOp",256+26,sprites%,Plyr1$,"square10" 9480SYS"OS_SpriteOp",256+26,sprites%,Plyr2$,"square20" 9490Plyr1$=LEFT$(Plyr1$,LEN(Plyr1$)-2) 9500Plyr2$=LEFT$(Plyr2$,LEN(Plyr2$)-2) 9510FOR a=1TO4 9520SYS"OS_SpriteOp",256+40,sprites%,"square"+STR$a+"0" TO ,,,w,h 9530FOR b=1TO8 9540grsizes(0,(a*10)+b)=2*(w*((16+b)/24)):grsizes(1,(a*10)+b)=4*(h*((16+b)/24)) 9550SYS"OS_SpriteOp",256+15,sprites%,"square"+STR$a+STR$b,0,w*((16+b)/24),h*((16+b)/24),12 9560SYS"OS_SpriteOp",256+29,sprites%,"square"+STR$a+STR$b 9570SYS"OS_SpriteOp",256+60,sprites%,"square"+STR$a+STR$b 9580!block%=16+b:block%!4=16+b 9590 9600block%!8=24:block%!12=24 9610SYS"OS_SpriteOp",256+52,sprites%,"square"+STR$a+"0",0,0,0,block% 9620SYS"OS_SpriteOp",256+61,sprites%,"square"+STR$a+STR$b 9630GCOL0 9640SYS"OS_SpriteOp",256+52,sprites%,"square"+STR$a+"0",0,0,&8,block%,pixel 9650NEXT 9660NEXT 9670SYS"OS_SpriteOp",256+60,sprites%,0 9680loaded=lgrld 9690PROCsetplyrnames 9700bdimens=dimension:dimension=0:PROCsetdimension(bdimens) 9710SYS"Hourglass_Off" 9720ENDPROC 9730 9740DEFPROCstartdrag 9750!block%=save_handle% 9760SYS"Wimp_GetWindowState",,block% 9770ysize%=block%!16-block%!8 9780x%=block%!4:y%=block%!8 9790block%!4=0 9800SYS"Wimp_GetIconState",,block% 9810!block%=0 9820block%!4=5 9830block%!8+=x% 9840block%!12+=y%+ysize% 9850block%!16+=x% 9860block%!20+=y%+ysize% 9870block%!24=0 9880block%!28=0 9890SYS"OS_ReadModeVariable",-1,4 TO ,,xtentsh 9900SYS"OS_ReadModeVariable",-1,5 TO ,,ytentsh 9910SYS"OS_ReadModeVariable",-1,11 TO ,,xtent 9920SYS"OS_ReadModeVariable",-1,12 TO ,,ytent 9930block%!32=((xtent+1)*2^xtentsh)-1 9940block%!36=((ytent+1)*2^ytentsh)-1 9950SYS"Wimp_DragBox",,block% 9960ENDPROC 9970 9980DEFPROCdragdone 9990SYS"Wimp_GetPointerInfo",,block% 10000!block%=60 10010block%!20=block%!12 10020block%!12=0 10030block%!24=block%!16 10040block%!16=1 10050block%!28=!block% 10060block%!32=block%!4 10070block%!40=&560 10080$(block%+44)=FNlastbit(FNgettext(save_handle%,10)) 10090SYS"Wimp_SendMessage",17,block%,block%!20 10100ENDPROC 10110 10120DEFFNlastbit(lb$) 10130lbr$="":lbc=0 10140REPEAT 10150lbc+=1 10160lbr$=RIGHT$(lb$,lbc) 10170UNTIL LEFT$(lbr$,1)="." OR LEN(lbr$)=LEN(lb$) 10180IF LEFT$(lb$,lbc)="." THEN :=RIGHT$(lbr$,LEN(lbr$)-1) 10190=lbr$ 10200 10210DEFPROCsave(savename$) 10220IF INSTR(savename$,".")<1 THEN PROCerror("To save, drag the file icon to a directory viewer",FALSE):ENDPROC 10230SYS"Hourglass_On" 10240A%=OPENOUTsavename$ 10250BPUT#A%,dimension 10260BPUT#A%,Go 10270BPUT#A%,Plyr1 10280BPUT#A%,Plyr2 10290BPUT#A%,level% 10300BPUT#A%,graphic$(lgrld); 10310BPUT#A%,STRING$(10-LEN(graphic$(lgrld)),"."); 10320BPUT#A%,pos 10330FOR p=0TO(pos*44)-1 10340BPUT#A%,store?p 10350NEXT 10360CLOSE#A% 10370OSCLI"settype "+savename$+" 560" 10380SYS"Hourglass_Off" 10390IF iconclicked=FALSE THEN SYS"Wimp_CreateMenu",,-1 10400filename$=savename$ 10410PROCalterIcon(save_handle%,10,"!"+filename$,0,1) 10420ENDPROC 10430 10440DEFPROCconcede 10450playing%=FALSE 10460conceded=TRUE 10470PROCgreymenu(0,TRUE,TRUE) 10480IF Go=1 THEN Gcn$=Plyr1$ ELSE Gcn$=Plyr2$ 10490IF RIGHT$(Gcn$,1)="s" THEN Gcn$+=" concede" ELSE Gcn$+=" concedes" 10500PROCalterIcon(main_handle%,Gotexticon,"!"+Gcn$,0,1) 10510PROCalterIcon(main_handle%,goicon,"#",0,1) 10520Go+=2 10530ENDPROC 10540 10550DEFPROCnewgame 10560conceded=FALSE 10570SYS"Hourglass_On" 10580incomp=FALSE 10590IF instep THEN instep=FALSE:!block%=stepthru_handle%:PROCclose 10600playing%=TRUE 10610PROCrestore(0):SYS"Wimp_ForceRedraw",main_handle%,0,-1024,1280,0 10620PROCungreymenu(TRUE,TRUE,TRUE) 10630SYS"Hourglass_Off" 10640ENDPROC 10650 10660DEFPROCcheckifhuff 10670nhuff()=0:nphuff=0 10680FOR s=0 TO 63 10690IF square(s)<>0 AND (square(s)=Go OR square(s)=Go+2) THEN 10700si=square(s) 10710IF si=1 THEN d1=TRUE:d2=FALSE 10720IF si=2 THEN d1=FALSE:d2=TRUE 10730IF si>2 THEN d1=TRUE:d2=TRUE 10740IF (FNrow(s)-2 = FNrow(s-14)) AND d1=TRUE THEN 10750IF square(s-14)=0 AND FNopp(s-7) THEN PROCaddhuff(s) 10760ENDIF 10770IF (FNrow(s)-2 = FNrow(s-18)) AND d1=TRUE THEN 10780IF square(s-18)=0 AND FNopp(s-9) THEN PROCaddhuff(s) 10790ENDIF 10800IF (FNrow(s)+2 = FNrow(s+14)) AND d2=TRUE THEN 10810IF square(s+14)=0 AND FNopp(s+7) THEN PROCaddhuff(s) 10820ENDIF 10830IF (FNrow(s)+2 = FNrow(s+18)) AND d2=TRUE THEN 10840IF square(s+18)=0 AND FNopp(s+9) THEN PROCaddhuff(s) 10850ENDIF 10860ENDIF 10870NEXT 10880ENDPROC 10890 10900DEFPROCaddhuff(s) 10910already=FALSE 10920FOR h=0 TO nphuff-1 10930IF nhuff(h)=s THEN already=TRUE 10940NEXT 10950IF already THEN ENDPROC 10960nhuff(nphuff)=s 10970nphuff+=1 10980ENDPROC 10990 11000DEFPROChuff 11010inhuff=TRUE 11020setphuff=FALSE 11030!block%=graphics_handle% 11040PROCclose 11050SYS"Wimp_CreateMenu",,-1 11060done=FALSE 11070IF Go=1 THEN HGo$=Plyr2$ ELSE HGo$=Plyr1$ 11080PROCalterIcon(main_handle%,Gotexticon,"!Huff "+HGo$,0,1) 11090FOR h=0TOphuff-1 11100PROCsetpieceflags(huff(h),yellow) 11110NEXT 11120IF First<>-1 THEN PROCsetpieceflags(First,black):First=-1 11130PROCclearint 11140REPEAT 11150SYS"Wimp_Poll",mask%,block% TO reason% 11160CASE reason% OF 11170WHEN 2:SYS"Wimp_OpenWindow",,block% 11180WHEN 3:SYS"Wimp_CloseWindow",,block% 11190WHEN 6:PROChuffclick(block%!8,block%!12,block%!16) 11200WHEN 9:PROChuffmenu 11210WHEN 17,18:PROChuffmessage 11220ENDCASE 11230IF finished% PROCend 11240UNTIL done 11250FOR h=0 TO phuff-1 11260PROCsetpieceflags(huff(h),black) 11270NEXT 11280IF setphuff THEN phuff=FALSE 11290PROCsetgotext 11300PROCcountmen 11310PROCcheckifhuff 11320inhuff=FALSE 11330ENDPROC 11340 11350DEFPROChuffclick(button%,window%,icon%) 11360IF button%=2 THEN 11370IF window%=-2 THEN SYS"Wimp_CreateMenu",,barm,block%!0-64,228 11380IF window%=main_handle% THEN SYS"Wimp_CreateMenu",,canchm,block%!0-64,block%!4-16 11390mencr%=window% 11400ENDIF 11410IF button% <> 4 THEN ENDPROC 11420IF window%=-2 THEN PROCopenwindow(main_handle%) 11430IF window%=main_handle% THEN 11440ok=FALSE 11450IF dimension=2 AND icon%<64 THEN ok=TRUE 11460IF dimension=3 AND icon%<129 THEN ok=TRUE 11470IF ok THEN 11480IF dimension=3 THEN PROCfindoutwhich 11490IF icon%<64 AND icon%>0 THEN 11500found=-1 11510FOR h=0 TO phuff-1 11520IF icon%=huff(h) THEN found=huff(h) 11530NEXT 11540IF found<>-1 THEN 11550PROClightningbolt(found) 11560square(found)=0 11570done=TRUE 11580setphuff=TRUE 11590ENDIF 11600ENDIF 11610ENDIF 11620ENDIF 11630ENDPROC 11640 11650DEFPROChuffmenu 11660IF mencr%=main_handle% THEN done=TRUE:ENDPROC 11670IF mencr%=-2 AND block%!0=2 THEN finished%=TRUE 11680SYS"Wimp_GetPointerInfo",,block% 11690IF block%!8=1 THEN SYS"Wimp_CreateMenu",,barm,block%!0-64,228 11700ENDPROC 11710 11720DEFPROChuffmessage 11730CASE block%!16 OF 11740WHEN 0:finished%=TRUE 11750WHEN 2:PROCsave(FNtidy(block%+44)) 11760WHEN 3:IF block%!12=0 AND block%!40=&560 THEN PROCload(FNtidy(block%+44)):done=TRUE 11770WHEN &502:PROChelp 11780WHEN &400C0: 11790IF (mencr%=main_handle% AND block%!32=0 AND block%!36=1) THEN PROCopensave 11800IF (mencr%=-2 AND block%!32=1) THEN PROCopensave 11810IF (mencr%=main_handle% AND block%!32=2) THEN PROCopenplayers 11820ENDCASE 11830ENDPROC 11840 11850DEFPROClightningbolt(licon%) 11860IF dimension=3 THEN licon%+=65 11870!block%=main_handle% 11880block%!4=licon% 11890SYS"Wimp_GetIconState",,block% 11900exp=block%!8+((block%!16-block%!8)/2) 11910wyp=block%!12 11920!block%=main_handle% 11930block%!4=exp-36 11940block%!8=wyp+220 11950block%!12=block%!4+104 11960block%!16=block%!8+64 11970block%!20=-956276710 11980$(block%+24)="cloud" 11990SYS"Wimp_CreateIcon",,block% TO cldh 12000PROCalterIcon(main_handle%,cldh,"",0,1) 12010PROCpoll:IF finished% PROCend 12020!block%=main_handle% 12030block%!4=exp-20 12040block%!8=wyp+24 12050block%!12=block%!4+32 12060block%!16=block%!8+200 12070block%!20=-956276710 12080$(block%+24)="lightning" 12090SYS"Wimp_CreateIcon",,block% TO lgth 12100PROCalterIcon(main_handle%,lgth,"",0,1) 12110PROCpoll:IF finished% PROCend 12120time=TIME:REPEATUNTILTIME>time+10 12130PROCsetpiece(found,0) 12140PROCpoll:IF finished% PROCend 12150time=TIME:REPEATUNTILTIME>time+20 12160PROCalterIcon(main_handle%,lgth,"#",0,1) 12170!block%=main_handle% 12180block%!4=lgth 12190SYS"Wimp_DeleteIcon",,block% 12200PROCpoll:IF finished% PROCend 12210time=TIME:REPEATUNTILTIME>time+10 12220PROCalterIcon(main_handle%,cldh,"#",0,1) 12230!block%=main_handle% 12240block%!4=cldh 12250SYS"Wimp_DeleteIcon",,block% 12260PROCpoll:IF finished% PROCend 12270ENDPROC 12280 12290DEFPROCforce 12300fpos=pos 12310inforce=TRUE 12320!block%=graphics_handle% 12330PROCclose 12340SYS"Wimp_CreateMenu",,-1 12350fdone=FALSE 12360IF Go=1 THEN FGo$=Plyr2$ ELSE FGo$=Plyr1$ 12370IF First<>-1 THEN PROCsetpieceflags(First,black):First=-1 12380PROCclearint 12390SYS"Hourglass_On" 12400PROCrestore(pos-2) 12410SYS"Hourglass_Off" 12420PROCalterIcon(main_handle%,Gotexticon,"!Force "+FGo$,0,1) 12430REPEAT 12440SYS"Wimp_Poll",mask%,block% TO reason% 12450CASE reason% OF 12460WHEN 2:SYS"Wimp_OpenWindow",,block% 12470WHEN 3:SYS"Wimp_CloseWindow",,block% 12480WHEN 6:PROCforceclick(block%!8,block%!12,block%!16) 12490WHEN 9:PROCforcemenu 12500WHEN 17,18:PROChuffmessage 12510ENDCASE 12520IF finished% PROCend 12530UNTIL fdone 12540inforce=FALSE 12550ENDPROC 12560 12570DEFPROCforceclick(button%,window%,icon%) 12580IF button%=2 THEN 12590IF window%=-2 THEN SYS"Wimp_CreateMenu",,barm,block%!0-64,228 12600IF window%=main_handle% THEN SYS"Wimp_CreateMenu",,cancfm,block%!0-64,block%!4-16 12610mencr%=window% 12620ENDIF 12630IF button%=2 THEN ENDPROC 12640IF window%=-2 AND button%=4 THEN PROCopenwindow(main_handle%) 12650IF window%=main_handle% THEN 12660ok=FALSE 12670IF dimension=2 AND icon%<64 THEN ok=TRUE 12680IF dimension=3 AND icon%<129 THEN ok=TRUE 12690IF ok THEN 12700IF dimension=3 THEN PROCfindoutwhich 12710IF icon%<64 AND icon%>-1 THEN PROCboardclick(icon%) 12720ENDIF 12730ENDIF 12740ENDPROC 12750 12760DEFPROCforcemenu 12770IF mencr%=main_handle% THEN 12780fdone=TRUE 12790SYS"Hourglass_On" 12800PROCrestore(fpos-1) 12810SYS"Hourglass_Off" 12820ENDIF 12830IF mencr%=main_handle% THEN ENDPROC 12840IF mencr%=-2 AND block%!0=2 THEN finished%=TRUE 12850SYS"Wimp_GetPointerInfo",,block% 12860IF block%!8=1 THEN SYS"Wimp_CreateMenu",,barm,block%!0-64,228 12870ENDPROC 12880 12890DEFPROChelp 12900window%=block%!32:icon%=block%!36 12910block%!12=block%!8:block%!16=&503 12920text%=block%+20 12930$text%="This is the Draughts application.|M" 12940CASE window% OF 12950WHEN -2:$text%="Click Select over this icon to open the main playing window.|MClick Menu over this icon to open the icon bar menu for Draughts.|M" 12960WHEN main_handle%: 12970IF (dimension=3 AND icon%<129) OR (dimension=2 AND icon%<64) THEN 12980text$="This is the main playing board.|M" 12990IF inhuff=FALSE THEN 13000IF First=-1 THEN text$+="Click Select over the piece which you wish to move. The square on which it rests will be highlighted red. If you change your mind, click Select over the piece a second time.|M" 13010IF First<>-1 THEN text$+="Click Select over the square to which you wish your piece to move. If you wish to make multiple jumps, use Adjust to select the intermediate squares, which will be highlighted green.|M" 13020ELSE 13030text$+="Click Select over any one of the pieces on a yellow square - that piece will then be huffed. To cancel the operation, use the main menu.|M" 13040ENDIF 13050$text%=text$ 13060ENDIF 13070WHEN pane_handle%: 13080$text%="Click on the graphics file you wish to load, then select OK.|M" 13090WHEN graphics_handle% 13100IF icon%>0 THEN $text%="Selecting OK will load the specified graphics file.|M" 13110WHEN save_handle%: 13120IF icon%=0 THEN $text%="Drag this icon to a directory viewer to save.|M" 13130IF icon%=9 THEN $text%="Selecting OK will save the current game status.|M" 13140IF icon%=10 THEN $text%="Enter the filename in this icon, then press Return to save.|M" 13150WHEN players_handle%: 13160CASE icon% OF 13170WHEN 18:$text%="This icon shows the skill level of the computer player(s), if any.|M" 13180WHEN 19:$text%="Selecting this icon will decrease the skill level of the computer player(s), if any.|M" 13190WHEN 20:$text%="Selecting this icon will increase the skill level of the computer player(s), if any.|M" 13200WHEN 3: 13210IF Plyr1=0 THEN P1$="user":P2$="computer" ELSE P1$="computer":P2$="user" 13220$text%="Selecting this icon will change player one from "+P1$+" to "+P2$+" control.|M" 13230WHEN 7: 13240IF Plyr2=0 THEN P1$="user":P2$="computer" ELSE P1$="computer":P2$="user" 13250$text%="Selecting this icon will change player two from "+P1$+" to "+P2$+" control.|M" 13260ENDCASE 13270WHEN stepthru_handle%: 13280CASE icon% OF 13290WHEN 0:$text%="This icon resets the board to the first position.|M" 13300WHEN 1:$text%="This icon moves the game status back one move.|M" 13310WHEN 2:$text%="This icon sets the current game status to that shown and resumes play.|M" 13320WHEN 3:$text%="This icon moves the game status forward one move.|M" 13330WHEN 4:$text%="This icon resets the board to the last position recorded.|M" 13340ENDCASE 13350ENDCASE 13360!block%=(LEN$text%+25)ANDNOT3 13370SYS"Wimp_SendMessage",17,block%,block%!4 13380ENDPROC 13390 13400DEFFNnextdepth(depth) 13410bscore(depth)=-100 13420pjump(depth)=FALSE 13430FOR piece(depth)=0 TO 31 13440PROCpoll:IF finished% PROCend 13450IF incomp=FALSE THEN piece(depth)=31:=0 13460score(depth)=0 13470IF quad(depth,1,numsq(piece(depth)))=FNgo(depth) OR quad(depth,1,numsq(piece(depth)))=FNkgo(depth) THEN 13480PROCdir(depth,numsq(piece(depth))) 13490maxlev(depth)=0:lev(depth)=1:PROCcheckifjump(numsq(piece(depth)),depth) 13500ENDIF 13510NEXT 13520 13530IF pjump(depth)=TRUE THEN :=bscore(depth) 13540IF depth=level% AND depth>2 THEN :=0 13550bscore(depth)=-100 13560FOR piece(depth)=0 TO 31 13570PROCpoll:IF finished% PROCend 13580IF incomp=FALSE THEN piece(depth)=31:=0 13590score(depth)=0 13600IF quad(depth,1,numsq(piece(depth)))=FNgo(depth) OR quad(depth,1,numsq(piece(depth)))=FNkgo(depth) THEN 13610PROCdir(depth,numsq(piece(depth))) 13620PROCcheckifmove(numsq(piece(depth)),depth) 13630ENDIF 13640NEXT 13650 13660IF pjump(depth)=FALSE THEN :=-500 13670=bscore(depth) 13680 13690DEFPROCdir(depth,pc) 13700dGo=0 13710IF (depth AND 1)=1 THEN dGo=Go 13720IF dGo=0 AND Go=2 THEN dGo=1 13730IF dGo=0 AND Go=1 THEN dGo=2 13740IF quad(depth,1,pc)>2 THEN dGo+=2 13750IF dGo=1 THEN d1(depth)=TRUE:d2(depth)=FALSE 13760IF dGo=2 THEN d2(depth)=TRUE:d1(depth)=FALSE 13770IF dGo>2 THEN d1(depth)=TRUE:d2(depth)=TRUE 13780ENDPROC 13790 13800DEFFNgo(depth) 13810dGo=0 13820IF (depth AND 1)=1 THEN dGo=Go 13830IF dGo=0 AND Go=2 THEN dGo=1 13840IF dGo=0 AND Go=1 THEN dGo=2 13850=dGo 13860 13870DEFFNkgo(depth) 13880dGo=0 13890IF (depth AND 1)=1 THEN dGo=Go 13900IF dGo=0 AND Go=2 THEN dGo=1 13910IF dGo=0 AND Go=1 THEN dGo=2 13920=dGo+2 13930 13940DEFPROCcheckifjump(piece,depth) 13950king(depth,lev(depth))=FALSE 13960oldnj(depth,lev(depth))=nj(depth,lev(depth)-1) 13970nj(depth,lev(depth))=nj(depth,lev(depth)-1) 13980IF FNrow(piece)-2 = FNrow(piece-14) AND d1(depth) THEN 13990IF quad(depth,lev(depth),piece-14)=0 AND FNcopp(depth,piece-7) THEN 14000IF quad(depth,lev(depth),piece)=1 AND (piece-14>-1 AND piece-14<8) THEN king(depth,lev(depth))=TRUE 14010FOR q=0 TO 31:quad(depth,lev(depth)+1,numsq(q))=quad(depth,lev(depth),numsq(q)):NEXT 14020quad(depth,lev(depth)+1,piece-14)=quad(depth,lev(depth),piece) 14030IF king(depth,lev(depth)) THEN quad(depth,lev(depth),piece)+=2 14040quad(depth,lev(depth)+1,piece-7)=0:quad(depth,lev(depth)+1,piece)=0 14050nj(depth,lev(depth))=oldnj(depth,lev(depth))+1 14060lev(depth)+=1 14070PROCcheckifjump(piece-14,depth) 14080lev(depth)-=1 14090king(depth,lev(depth))=FALSE 14100pjump(depth)=TRUE 14110ENDIF 14120ENDIF 14130: 14140IF FNrow(piece)-2 = FNrow(piece-18) AND d1(depth) THEN 14150IF quad(depth,lev(depth),piece-18)=0 AND FNcopp(depth,piece-9) THEN 14160IF quad(depth,lev(depth),piece)=1 AND (piece-18>-1 AND piece-18<8) THEN king(depth,lev(depth))=TRUE 14170FOR q=0 TO 31:quad(depth,lev(depth)+1,numsq(q))=quad(depth,lev(depth),numsq(q)):NEXT 14180quad(depth,lev(depth)+1,piece-18)=quad(depth,lev(depth),piece) 14190quad(depth,lev(depth)+1,piece-9)=0:quad(depth,lev(depth)+1,piece)=0 14200nj(depth,lev(depth))=oldnj(depth,lev(depth))+1 14210lev(depth)+=1 14220PROCcheckifjump(piece-18,depth) 14230lev(depth)-=1 14240king(depth,lev(depth))=FALSE 14250pjump(depth)=TRUE 14260ENDIF 14270ENDIF 14280: 14290IF FNrow(piece)+2 = FNrow(piece+14) AND d2(depth) THEN 14300IF quad(depth,lev(depth),piece+14)=0 AND FNcopp(depth,piece+7) THEN 14310IF quad(depth,lev(depth),piece)=2 AND (piece+14>55 AND piece+14<64) THEN king(depth,lev(depth))=TRUE 14320FOR q=0 TO 31:quad(depth,lev(depth)+1,numsq(q))=quad(depth,lev(depth),numsq(q)):NEXT 14330quad(depth,lev(depth)+1,piece+14)=quad(depth,lev(depth),piece) 14340quad(depth,lev(depth)+1,piece+7)=0:quad(depth,lev(depth)+1,piece)=0 14350nj(depth,lev(depth))=oldnj(depth,lev(depth))+1 14360lev(depth)+=1 14370PROCcheckifjump(piece+14,depth) 14380lev(depth)-=1 14390king(depth,lev(depth))=FALSE 14400pjump(depth)=TRUE 14410ENDIF 14420ENDIF 14430: 14440IF FNrow(piece)+2 = FNrow(piece+18) AND d2(depth) THEN 14450IF quad(depth,lev(depth),piece+18)=0 AND FNcopp(depth,piece+9) THEN 14460IF quad(depth,lev(depth),piece)=2 AND (piece+18>55 AND piece+18<64) THEN king(depth,lev(depth))=TRUE 14470FOR q=0 TO 31:quad(depth,lev(depth)+1,numsq(q))=quad(depth,lev(depth),numsq(q)):NEXT 14480quad(depth,lev(depth)+1,piece+18)=quad(depth,lev(depth),piece) 14490quad(depth,lev(depth)+1,piece+9)=0:quad(depth,lev(depth)+1,piece)=0 14500nj(depth,lev(depth))=oldnj(depth,lev(depth))+1 14510lev(depth)+=1 14520PROCcheckifjump(piece+18,depth) 14530lev(depth)-=1 14540king(depth,lev(depth))=FALSE 14550pjump(depth)=TRUE 14560ENDIF 14570ENDIF 14580: 14590IF lev(depth)>1 AND oldnj(depth,lev(depth))=nj(depth,lev(depth)) THEN 14600tempscore(depth)=lev(depth)+1 14610IF king(depth,lev(depth)-1) THEN tempscore(depth)+=1 14620IF (depth AND 1)=0 THEN tempscore(depth)=tempscore(depth)*2 14630IF depth<level% THEN 14640FOR q=0TO31 14650quad(depth+1,1,numsq(q))=quad(depth,lev(depth),numsq(q)) 14660NEXT 14670tempscore(depth)-=FNnextdepth(depth+1) 14680ENDIF 14690IF tempscore(depth)>bscore(depth) OR (tempscore(depth)=bscore(depth) AND RND(2)=2) THEN 14700bscore(depth)=tempscore(depth) 14710IF depth=1 THEN 14720FOR q=0TO63 14730bestpos(q)=quad(1,lev(1),q) 14740NEXT 14750ENDIF 14760ENDIF 14770ENDIF 14780ENDPROC 14790 14800DEFPROCcheckifmove(piece,depth) 14810king(depth,1)=FALSE:pmove(depth)=FALSE 14820 14830IF FNrow(piece)-1 = FNrow(piece-7) AND d1(depth) THEN 14840IF quad(depth,1,piece-7)=0 THEN 14850IF quad(depth,1,piece)=1 AND (piece-7>-1 AND piece-7<8) THEN king(depth,1)=TRUE 14860score(depth)=.5 14870IF king(depth,1) THEN score(depth)+=.4 14880IF (depth AND 1)=0 THEN score(depth)=score(depth)*2 14890IF depth<level% OR depth=1 THEN 14900FOR q=0 TO 31 14910quad(depth+1,1,numsq(q))=quad(depth,1,numsq(q)) 14920NEXT 14930quad(depth+1,1,piece-7)=quad(depth+1,1,piece) 14940quad(depth+1,1,piece)=0 14950IF king(depth,1) THEN quad(depth+1,1,piece-7)+=2 14960 14970 14980 14990IF depth<level% THEN score(depth)-=FNnextdepth(depth+1) 15000ENDIF 15010IF ((score(depth)>bscore(depth)) OR (score(depth)=bscore(depth) AND RND(2)=2)) AND depth=1 THEN 15020bscore(depth)=score(depth) 15030FOR q=0 TO 31 15040bestpos(numsq(q))=quad(depth+1,1,numsq(q)) 15050NEXT 15060ENDIF 15070pjump(depth)=TRUE:pmove(depth)=TRUE 15080king(depth,1)=FALSE 15090ENDIF 15100ENDIF 15110: 15120IF FNrow(piece)-1 = FNrow(piece-9) AND d1(depth) THEN 15130IF quad(depth,1,piece-9)=0 THEN 15140IF quad(depth,1,piece)=1 AND (piece-9>-1 AND piece-9<8) THEN king(depth,1)=TRUE 15150score(depth)=.5 15160IF king(depth,1) THEN score(depth)+=.4 15170IF (depth AND 1)=0 THEN score(depth)=score(depth)*2 15180IF depth<level% OR depth=1 THEN 15190FOR q=0 TO 31 15200quad(depth+1,1,numsq(q))=quad(depth,1,numsq(q)) 15210NEXT 15220quad(depth+1,1,piece-9)=quad(depth+1,1,piece) 15230quad(depth+1,1,piece)=0 15240IF king(depth,1) THEN quad(depth+1,1,piece-9)+=2 15250IF depth<level% THEN score(depth)-=FNnextdepth(depth+1) 15260ENDIF 15270IF ((score(depth)>bscore(depth)) OR (score(depth)=bscore(depth) AND RND(2)=2)) AND depth=1 THEN 15280bscore(depth)=score(depth) 15290FOR q=0 TO 31 15300bestpos(numsq(q))=quad(depth+1,1,numsq(q)) 15310NEXT 15320ENDIF 15330pjump(depth)=TRUE:pmove(depth)=TRUE 15340king(depth,1)=FALSE 15350ENDIF 15360ENDIF 15370: 15380IF FNrow(piece)+1 = FNrow(piece+7) AND d2(depth) THEN 15390IF quad(depth,1,piece+7)=0 THEN 15400IF quad(depth,1,piece)=1 AND (piece+7>55 AND piece+7<64) THEN king(depth,1)=TRUE 15410score(depth)=.5 15420IF king(depth,1) THEN score(depth)+=.4 15430IF (depth AND 1)=0 THEN score(depth)=score(depth)*2 15440IF depth<level% OR depth=1 THEN 15450FOR q=0 TO 31 15460quad(depth+1,1,numsq(q))=quad(depth,1,numsq(q)) 15470NEXT 15480quad(depth+1,1,piece+7)=quad(depth+1,1,piece) 15490quad(depth+1,1,piece)=0 15500IF king(depth,1) THEN quad(depth+1,1,piece+7)+=2 15510IF depth<level% THEN score(depth)-=FNnextdepth(depth+1) 15520ENDIF 15530IF ((score(depth)>bscore(depth)) OR (score(depth)=bscore(depth) AND RND(2)=2)) AND depth=1 THEN 15540bscore(depth)=score(depth) 15550FOR q=0 TO 31 15560bestpos(numsq(q))=quad(depth+1,1,numsq(q)) 15570NEXT 15580ENDIF 15590pjump(depth)=TRUE:pmove(depth)=TRUE 15600king(depth,1)=FALSE 15610ENDIF 15620ENDIF 15630: 15640IF FNrow(piece)+1 = FNrow(piece+9) AND d2(depth) THEN 15650IF quad(depth,1,piece+9)=0 THEN 15660IF quad(depth,1,piece)=1 AND (piece+9>55 AND piece+9<64) THEN king(depth,1)=TRUE 15670score(depth)=.5 15680IF king(depth,1) THEN score(depth)+=.4 15690IF (depth AND 1)=0 THEN score(depth)=score(depth)*2 15700IF depth<level% OR depth=1 THEN 15710FOR q=0 TO 31 15720quad(depth+1,1,numsq(q))=quad(depth,1,numsq(q)) 15730NEXT 15740quad(depth+1,1,piece+9)=quad(depth+1,1,piece) 15750quad(depth+1,1,piece)=0 15760IF king(depth,1) THEN quad(depth+1,1,piece+9)+=2 15770IF depth<level% THEN score(depth)-=FNnextdepth(depth+1) 15780ENDIF 15790IF ((score(depth)>bscore(depth)) OR (score(depth)=bscore(depth) AND RND(2)=2)) AND depth=1 THEN 15800bscore(depth)=score(depth) 15810FOR q=0 TO 31 15820bestpos(numsq(q))=quad(depth+1,1,numsq(q)) 15830NEXT 15840ENDIF 15850pjump(depth)=TRUE:pmove(depth)=TRUE 15860king(depth,1)=FALSE 15870ENDIF 15880ENDIF 15890 15900 15910 15920 15930 15940 15950 15960 15970 15980ENDPROC 15990 16000DEFFNcopp(depth,pc) 16010dOgo=0 16020IF (depth AND 1)=0 THEN dOgo=Go 16030IF dOgo=0 AND Go=2 THEN dOgo=1 16040IF dOgo=0 AND Go=1 THEN dOgo=2 16050IF quad(depth,lev(depth),pc)=dOgo OR quad(depth,lev(depth),pc)=dOgo+2 THEN :=TRUE 16060=FALSE 16070 16080DEFPROCcompgo 16090bestpos()=0 16100incomp=TRUE 16110PROCgreymenu(0,TRUE,TRUE) 16120PROCsetgoicon(TRUE):PROCpoll:IF finished% PROCend 16130IF incomp=FALSE THEN ENDPROC 16140bestscore=-500:bestpos2()=0 16150FORq=0TO63:quad(1,1,q)=square(q):NEXT 16160depth=1:hff=-1 16170scorenohuff=FNnextdepth(depth) 16180IF incomp=FALSE THEN PROCsetgotext:PROCungreymenu(TRUE,TRUE,TRUE):ENDPROC 16190IF scorenohuff>-250 THEN bestscore=scorenohuff:bestpos2()=bestpos() 16200IF phuff<>FALSE THEN 16210FOR h=0 TO phuff-1 16220FORq=0TO63:quad(1,1,q)=square(q):NEXT 16230quad(1,1,huff(h))=0 16240depth=1 16250thisscore=FNnextdepth(depth)+1 16260IF incomp=FALSE THEN h=phuff-1 16270IF thisscore>bestscore THEN bestscore=thisscore:bestpos2()=bestpos():hff=h 16280NEXT 16290ENDIF 16300IF incomp=FALSE THEN PROCsetgotext:PROCungreymenu(TRUE,TRUE,TRUE):ENDPROC 16310IF hff<>-1 THEN found=huff(hff):PROClightningbolt(huff(hff)) 16320PROCsetgoicon(FALSE) 16330IF bestscore<-250 THEN PROCconcede:ENDPROC 16340PROCpoll:IF finished% PROCend 16350 16360PROCsetboard 16370PROCungreymenu(TRUE,TRUE,TRUE) 16380PROCcountmen:PROCcheckifwon 16390nphuff=FALSE 16400PROCjustmoved 16410incomp=FALSE 16420ENDPROC 16430 16440DEFPROCsetboard 16450FORq=0TO63 16460IF q<8 AND bestpos2(q)=1 THEN bestpos2(q)+=2 16470IF q>55 AND bestpos2(q)=2 THEN bestpos2(q)+=2 16480IF square(q) <> bestpos2(q) THEN PROCsetpiece(q,bestpos2(q)):square(q)=bestpos2(q) 16490NEXT 16500ENDPROC 16510 16520DEFPROCopensave 16530SYS"Wimp_CreateSubMenu",,block%!20,block%!24,block%!28 16540PROCalterIcon(save_handle%,10,"!"+filename$,0,1) 16550SYS"Wimp_SetCaretPosition",save_handle%,10,,,-1,LEN(FNgettext(save_handle%,10)) 16560ENDPROC 16570 16580DEFPROCopenplayers 16590SYS"Wimp_CreateSubMenu",,block%!20,block%!24,block%!28 16600IF Plyr1=0 THEN P1$="User" ELSE P1$="Archie" 16610IF Plyr2=0 THEN P2$="User" ELSE P2$="Archie" 16620PROCalterIcon(players_handle%,3,"#"+P1$,0,1) 16630PROCalterIcon(players_handle%,7,"#"+P2$,0,1) 16640PROCalterIcon(players_handle%,18,"#"+STR$level%,0,1) 16650levelp%=level% 16660Plyr1p=Plyr1 16670Plyr2p=Plyr2 16680ENDPROC
�><Draughts$Dir>.!RunImage 5� �error(�$+" (internal error code "+(Þ)+")",�) �init (3� �error(�$+" (internal error code "+Þ+")",�) 2mask%=0 <� F �poll P� playing% � �checkifwon Z!� playing% � Plyr1=1 � Go=1 � d�compgo n�setgoicon(�) x� � �poll �� playing% � �checkifwon �!� playing% � Plyr2=1 � Go=2 � ��compgo ��setgoicon(�) �� �� finished% � � ��end �-È™"Wimp_CloseDown",task_handle%,&4B534154 �� � � ��poll (È™"Wimp_Poll",mask%,block% � reason% ÈŽ reason% � � 2:�open "� 3:�close ,,� 6:�click(block%!8,block%!12,block%!16) 6� 7:�dragdone @/� 8:�keypressed(!block%,block%!4,block%!24) J� 9:�decodemenu T� 17,18:�message ^� h� r� | ���error(err$,fatal%) �ș"Wimp_DragBox",,0 � !block%=� �$(block%+4)=err$ �,È™"Wimp_ReportError",block%,1,"Draughts" �8� fatal% � È™"Wimp_CloseDown",task_handle%,&4B534154 �� � � ��init �@È™"Wimp_Initialise",200,&4B534154,"Draughts" � ,task_handle% �� block% 5500,block2% 1024 �� main2% 4500,main3% 5500 �L� ind1% 49,ind2% 49,ind3% 350,ind4% 0,ind5% 30,ind6% 260,ind7% 0,ind8% 0 � pane% 920 � pixel 16:?pixel=0 �p=1�16:pixel?p=15:� &&È™"Wimp_SlotSize",-1,-1 � slotsize 0�setupvarsndims :grblacked=-1 Ddimension=0:�vars3d Nsprites%=(�+1)+(8192) X"È• (sprites% � 4)<> sprites%/4 bsprites%+=1 l� v�loadsprites �5È™"Wimp_OpenTemplate",,"<Draughts$Dir>.Templates" �>È™"Wimp_LoadTemplate",,main2%,ind1%,ind1%+49,-1,"main2D",0 �main2%!64=sprites% �>È™"Wimp_LoadTemplate",,main3%,ind2%,ind2%+49,-1,"main3D",0 �main3%!64=sprites% �0È™"Wimp_CreateWindow",,main3% � main_handle% �=È™"Wimp_LoadTemplate",,block%,ind3%,ind3%+350,-1,"info",0 �block%!64=sprites% �0È™"Wimp_CreateWindow",,block% � info_handle% �?È™"Wimp_LoadTemplate",,block%,ind4%,ind4%+0,-1,"stepthru",0 �block%!64=sprites% �4È™"Wimp_CreateWindow",,block% � stepthru_handle% �?È™"Wimp_LoadTemplate",,block%,ind5%,ind5%+30,-1,"players",0 block%!64=sprites% 3È™"Wimp_CreateWindow",,block% � players_handle% ?È™"Wimp_LoadTemplate",,block%,ind6%,ind6%+260,-1,"saveas",0 0È™"Wimp_CreateWindow",,block% � save_handle% *?È™"Wimp_LoadTemplate",,block%,ind8%,ind8%+0,-1,"graphics",0 44È™"Wimp_CreateWindow",,block% � graphics_handle% >:È™"Wimp_LoadTemplate",,pane%,ind7%,ind7%+0,-1,"pane",0 HÈ™"Wimp_CloseTemplate" Rfilename$="DrghtsGame" \�setupboarddata f�findgraphics p�setupmenus z�loadfile_startedwith �$!block%=-1:block%!4=0:block%!8=0 �-block%!12=84:block%!16=68:block%!20=&3002 �$(block%+24)="!Draughts" �*È™"Wimp_CreateIcon",,block% � iconbar% �� � ���setupboarddata �fnumsq()=1,3,5,7,8,10,12,14,17,19,21,23,24,26,28,30,33,35,37,39,40,42,44,46,49,51,53,55,56,58,60,62 �!block%=main_handle% �� ic=0 � 31 �icn=numsq(ic) �block%!4=icn �!È™"Wimp_GetIconState",,block% (xcoord(icn)=(block%!8 + block%!16)/2 yrow=(icn � 8)+1 ycoord(yrow)=block%!12 $sqsizes(0,icn)=block%!8 .sqsizes(1,icn)=block%!12-4 8sqsizes(2,icn)=block%!16 Bsqsizes(3,icn)=block%!20 L� V� ` j��loadsprites t S%=�"<Draughts$Dir>.Sprites" ~spl=�#S%+16 ��#S% �!�slotsize(slotsize+spl+16384) �� nslot<(slotsize+spl) � �c�error("Insufficient memory to load application Sprites file - need approximately 20k.",�):�end �� �slotsize+=spl+16384 �!block%=spl:block%!4=0 � sprites%!8=16:sprites%!12=16 �-� **** SYS"OS_SpriteOp",265,sprites% **** �9È™"OS_SpriteOp",266,sprites%,"<Draughts$Dir>.Sprites" �� � ��findgraphics MÈ™"OS_GBPB",9,"<Draughts$Dir>.Graphics",block%,256,0,8192,0 � ,,,ngrfiles offset=0 � f=1� ngrfiles ( f$="" 2� <f$+=�(block%?offset) F offset+=1 P� block%?offset =0 Z offset+=1 dgraphic$(f)=f$ n� xpane%!44=-(56*ngrfiles) � � ngrfiles<3 � pane%!44=-156 �/È™"Wimp_CreateWindow",,pane% � pane_handle% �� f=1� ngrfiles �4�alterIcon(pane_handle%,f-1,"#"+graphic$(f),0,1) �� �� � ���loadfile_startedwith �ș"OS_GetEnv" � env$ �+env$=�env$,�env$,"""",�env$,"""")+1)+1) �ȕ �env$,1)=" " �env$=�env$,2) �� firstload=� �load(env$) firstload=� "� , 6��store @� s=0�31 J'store?((pos*44)+s)=square(numsq(s)) T� ^� h=0 � 10 h!store?((pos*44)+h+32)=huff(h) r� |store?((pos*44)+43)=phuff � pos+=1 �� � ���restoreboard(rpos) �� s=0�31 �_� square(numsq(s))<>store?((rpos*44)+s) � indim=� � �setpiece(numsq(s),store?((rpos*44)+s)) �(square(numsq(s))=store?((rpos*44)+s) �� � �countmen �� � ���restore(rpos) �ș"Hourglass_On" pos=rpos+1 �restoreboard(rpos) � h=0 � 10 &"huff(h)=store?((rpos*44)+32+h) 0� :phuff=store?((rpos*44)+43) D)� (pos � 1) � Go=1:Ogo=2 � Go=2:Ogo=1 N�setgotext X�checkifhuff b�ungreymenu(�,�,�) lÈ™"Hourglass_Off" v� � ���setgotext ��setgoicon(�) �$� Go=1 � Go$=Plyr1$ � Go$=Plyr2$ �2� �Go$,1)="s" � Go$+="' turn" � Go$+="'s turn" �3�alterIcon(main_handle%,Gotexticon,"!"+Go$,0,1) �� � ���countmen �m1=0:m2=0:k3=0:k4=0 �� s=0 � 63 �Ȏ square(s) � � � 1:m1+=1 � 2:m2+=1 � 3:k3+=1 � 4:k4+=1 � *� 40�alterIcon(main_handle%,m1_icon,"#"+�m1,0,1) >0�alterIcon(main_handle%,m2_icon,"#"+�m2,0,1) H0�alterIcon(main_handle%,k3_icon,"#"+�k3,0,1) R0�alterIcon(main_handle%,k4_icon,"#"+�k4,0,1) \� f p��setpiece(piecen,piece) z� dimension=2 � �<�alterIcon(main_handle%,piecen,"#square"+�piece+"9",0,1) �� �.�alterIcon(main_handle%,piecen+65,"#",0,1) �row=�row(piecen) �+!block%=main_handle%:block%!4=piecen+65 �!È™"Wimp_GetIconState",,block% �ș"Wimp_DeleteIcon",,block% �piecegn=(piece*10)+row �grx=grsizes(0,piecegn) �gry=grsizes(1,piecegn) �block%!4=main_handle% �#block%!8=xcoord(piecen)-(grx/2) �block%!12=ycoord(row)+4 block%!16=block%!8+grx block%!20=block%!12+gry block%!24=&301A $"$(block%+28)="square"+�piecegn .!È™"Wimp_CreateIcon",,block%+4 8LÈ™"Wimp_ForceRedraw",main_handle%,block%!8,block%!12,block%!16,block%!20 B� L� V `!��setpieceflags(piecen,flags) j.�alterIcon(main_handle%,piecen,"",flags,1) t� ~ ���load(loadname$) �inload=� �ș"Hourglass_On" �A%=�loadname$ �dimension=�#A% �GoI=�#A% �Plyr1=�#A% �Plyr2=�#A% �level%=�#A% �grld$="" � � g=0 � 9 �grld$+=�(�#A%) � g=�grld$,".") � g>0 � grld$=�grld$,g-1) pos=�#A% (� p=0 � (pos*44)-1 2store?p=�#A% <� F�#A% P�setgraphics(grld$) Z2�alterIcon(players_handle%,18,"#"+�level%,0,1) dU� instep=� � spos=pos-1:�click(4,stepthru_handle%,4):�click(4,stepthru_handle%,2) nF� firstload=� � bdimen=dimension:dimension=0:�setdimension(bdimen) x � GoI>2 � �Go=GoI-2 �� Go=1 � Ogo=2 � Ogo=1 ��concede �� � Go=GoI �� Go=1 � Ogo=2 � Ogo=1 �� �U� firstload=� � filename$=loadname$:�alterIcon(save_handle%,10,"!"+filename$,0,1) �ș"Hourglass_Off" �inload=� �� � ���setdimension(newdimens) � dimension=newdimens � � 8!block%=main_handle%:È™"Wimp_GetWindowState",,block% infront=block%!28 "dimension=newdimens ,!block%=main_handle% 6!È™"Wimp_DeleteWindow",,block% @� dimension=2 � J0È™"Wimp_CreateWindow",,main2% � main_handle% T�vars2d ^dimenm!28=1:dimenm!52=&80 h� r0È™"Wimp_CreateWindow",,main3% � main_handle% |�vars3d �dimenm!28=0:dimenm!52=&81 �� �indim=� ��restore(pos-1) �indim=� �1� Plyr1=0 � MPlyr1$="User" � MPlyr1$="Archie" �1� Plyr2=0 � MPlyr2$="User" � MPlyr2$="Archie" �5�alterIcon(main_handle%,mplayer1,"#"+MPlyr1$,0,1) �1�alterIcon(players_handle%,3,"#"+MPlyr1$,0,1) �5�alterIcon(main_handle%,mplayer2,"#"+MPlyr2$,0,1) �1�alterIcon(players_handle%,7,"#"+MPlyr2$,0,1) �+� First<>-1 � �setpieceflags(First,red) �� nint>0 � � i=1�nint �setpieceflags(int(i),green) � &� 0�setplyrnames :�countmen:�checkifwon D� conceded �concede N� mainopen � X!block%=main_handle% b#È™"Wimp_GetWindowState",,block% lblock%!28=infront vÈ™"Wimp_OpenWindow",,block% �� �� � ���openwindow(handle%) �'� handle%=main_handle% � mainopen=� �!block%=handle% �#È™"Wimp_GetWindowState",,block% �ș"Wimp_OpenWindow",,block% �� � ���setgoicon(thinking) �<� playing%=� � �alterIcon(main_handle%,goicon,"#",0,1):� �� thinking � � Go=1 � Plyr1=0 � ic$="cm3" � Go=1 � Plyr1=1 � ic$="cm1" � Go=2 � Plyr2=0 � ic$="cm3" � Go=2 � Plyr2=1 � ic$="cm1" *� 4� thinking=� � > � Go=1 � Plyr1=0 � ic$="cm4" H � Go=1 � Plyr1=1 � ic$="cm2" R � Go=2 � Plyr2=0 � ic$="cm4" \ � Go=2 � Plyr2=1 � ic$="cm2" f� p/�alterIcon(main_handle%,goicon,"#"+ic$,0,1) z� � ���setgraphics(grld$) �lgrld=0 �� g=1 � ngrfiles �!� graphic$(g)=grld$ � lgrld=g �� �� **** lgrld=2 **** ��panemove(lgrld) �"�click(4,pane_handle%,lgrld-1) � �click(4,graphics_handle%,6) �� � ���grclicked(icon%) !� icon%>-1 � icon%<ngrfiles � 7�alterIcon(pane_handle%,grblacked-1,"",&17006039,1) grblacked=icon%+1 $7�alterIcon(pane_handle%,grblacked-1,"",&70006039,1) .� 8� B L��panemove(whereto) V!block%=pane_handle% `#È™"Wimp_GetWindowState",,block% jblock%!24=40*(whereto-1) t,� inload=� � È™"Wimp_OpenWindow",,block% ~� � � ���justmoved �$� Go=1 � Go=2:Ogo=1 � Go=1:Ogo=2 �huff()=nhuff() �phuff=nphuff � �store ��checkifhuff �� playing% � �setgotext �First=-1:Second=-1 �� � "��click(button%,window%,icon%) (� button%=2 � �menucreate(window%):� 8� window%=-2 � button%=4 � �openwindow(main_handle%) � window%=save_handle% � (� icon%=0 � �startdrag 2� icon%=9 � <� button%=1 � iconclicked=� F$�save(�gettext(save_handle%,10)) Piconclicked=� Z� d� n� window%=pane_handle% � x�grclicked(icon%) �� � � window%=graphics_handle% � �� icon%=6 � �'� grblacked<>loaded � firstload=� � �lgrld=grblacked �=�loadgraphics("<Draughts$Dir>.Graphics."+graphic$(lgrld)) �� �1� button%=4 � !block%=graphics_handle%:�close �� �� �� window%=players_handle% � �� icon%=3 � icon%=7 � �!� icon%=3 � Plyr1p=Plyr1p � 1 !� icon%=7 � Plyr2p=Plyr2p � 1 *� Plyr1p=0 � P1$="User" � P1$="Archie" *� Plyr2p=0 � P2$="User" � P2$="Archie" "� icon%=3 � ,-�alterIcon(players_handle%,3,"#"+P1$,0,1) 6� @-�alterIcon(players_handle%,7,"#"+P2$,0,1) J� T� ^/� button%=1 � icon%=19 � icon%=20:button%=4 h/� button%=1 � icon%=20 � icon%=19:button%=4 rW� icon%=19 � levelp%>1 � levelp%-=1:�alterIcon(players_handle%,18,"#"+�levelp%,0,1) |X� icon%=20 � levelp%<ld � levelp%+=1:�alterIcon(players_handle%,18,"#"+�levelp%,0,1) �� icon%=26 � �level%=levelp% �Plyr1=Plyr1p:Plyr2=Plyr2p �� Go=1 � Plyr1=0 � incomp=� �� Go=2 � Plyr2=0 � incomp=� �)� Plyr1=0 � P1$="User" � P1$="Archie" �)� Plyr2=0 � P2$="User" � P2$="Archie" �1�alterIcon(main_handle%,mplayer1,"#"+P1$,0,1) �1�alterIcon(main_handle%,mplayer2,"#"+P2$,0,1) �)� button%=4 � È™"Wimp_CreateMenu",,-1 �� �� �+� window%=stepthru_handle% � icon% <5 � �stepthru(icon%) � ?� window%=main_handle% � playing%=� � incomp=� � instep=� � &ok=� 0#� dimension=2 � icon%<64 � ok=� :$� dimension=3 � icon%<129 � ok=� D � ok � N!� dimension=3 � �findoutwhich X.� icon%<64 � icon%>-1 � �boardclick(icon%) b� l� v� � ���setupmenus �M� mainm 520,barm 520,miscm 520,dimenm 520,huffm 520,canchm 520,cancfm 520 �menu=mainm �M$menu="Draughts":menu!12=&70207:menu!16=204:menu!20=44:menu!24=0:menu+=28 �;menu!0=0:menu!4=miscm:menu!8=&7000021:$(menu+12)="Misc" �Cmenu!24=0:menu!28=-1:menu!32=&7000021:$(menu+36)="Step thru..." �Kmenu!48=8:menu!52=players_handle%:menu!56=&7000021:$(menu+60)="Players" �Bmenu!72=0:menu!76=-1:menu!80=&7000021:$(menu+84)="Graphics..." �Cmenu!96=2:menu!100=dimenm:menu!104=&7000021:$(menu+108)="Board" �Bmenu!120=0:menu!124=huffm:menu!128=&7000021:$(menu+132)="Huff" �Bmenu!144=0:menu!148=-1:menu!152=&7000021:$(menu+156)="Concede" �Emenu!168=&80:menu!172=-1:menu!176=&7000021:$(menu+180)="New game" menu=barm M$menu="Draughts":menu!12=&70207:menu!16=120:menu!20=44:menu!24=0:menu+=28 Bmenu!0=0:menu!4=info_handle%:menu!8=&7000021:$(menu+12)="Info" Emenu!24=8:menu!28=save_handle%:menu!32=&7000021:$(menu+36)="Save" *=menu!48=&80:menu!52=-1:menu!56=&7000021:$(menu+60)="Quit" 4menu=miscm >H$menu="Misc":menu!12=&70207:menu!16=96:menu!20=44:menu!24=0:menu+=28 HBmenu!0=0:menu!4=info_handle%:menu!8=&7000021:$(menu+12)="Info" RGmenu!24=&88:menu!28=save_handle%:menu!32=&7000021:$(menu+36)="Save" \menu=dimenm fJ$menu="Board":menu!12=&70207:menu!16=208:menu!20=44:menu!24=0:menu+=28 p@menu!0=0:menu!4=-1:menu!8=&7000021:$(menu+12)="2 dimensions" zEmenu!24=&80:menu!28=-1:menu!32=&7000021:$(menu+36)="3 dimensions" �menu=huffm �I$menu="Huff":menu!12=&70207:menu!16=100:menu!20=44:menu!24=0:menu+=28 �8menu!0=0:menu!4=-1:menu!8=&7000021:$(menu+12)="Huff" �>menu!24=&80:menu!28=-1:menu!32=&7000021:$(menu+36)="Force" �menu=canchm �I$menu="Huff":menu!12=&70207:menu!16=112:menu!20=44:menu!24=0:menu+=28 �<menu!0=&80:menu!4=-1:menu!8=&7000021:$(menu+12)="Cancel" �menu=cancfm �J$menu="Force":menu!12=&70207:menu!16=112:menu!20=44:menu!24=0:menu+=28 �<menu!0=&80:menu!4=-1:menu!8=&7000021:$(menu+12)="Cancel" �� � ���menucreate(window%) mencr%=window% +� mencr%<>-2 � mencr%<>main_handle% � � ;� mencr%=-2 � È™"Wimp_CreateMenu",,barm,block%!0-64,228 $N� mencr%=main_handle% � È™"Wimp_CreateMenu",,mainm,block%!0-64,block%!4+16 .� 8 Bݤgettext(window%,icon%) LC!block2%=window%:block2%!4=icon%:È™"Wimp_GetIconState",,block2% V@� (block2%!24 � 256)=256 � :=$(block2%!28) � :=$(block2%+28) ` j��slotsize(newslot) t(È™"Wimp_SlotSize",newslot,-1 � nslot ~� � ���stepthru(icon%) �+� icon%=0 � steppos=0:�restore(steppos) �.� icon%=4 � steppos=spos:�restore(steppos) �8� icon%=1 � steppos>0 � steppos-=1:�restore(steppos) �;� icon%=3 � steppos<spos � steppos+=1:�restore(steppos) �� icon%=2 � �#!block%=stepthru_handle%:�close �instep=�:playing%=� �conceded=� �"�restore(steppos):�checkifhuff �� � ��findoutwhich ,� icon%=64 � �clicksquare � �findoutreal (,� icon%>64 � �clicksquare � �findoutreal 2� icon%>64 � icon%-=65 <� F Pݤclicksquare Z#È™"Wimp_GetPointerInfo",,block% dmxco=!block%:myco=block%!4 n)È™"OS_ReadModeVariable",-1,3 � ,,coll x!� �mxco,myco)=�modecol1 � :=� �!� �mxco,myco)=�modecol2 � :=� �!� �mxco,myco)=�modecol3 � :=� �=� � �ݤmodecol1 �� coll=1 � :=1 �� coll=3 � :=3 �� coll=15 � :=7 �� coll=63 � :=0 �=� � �ݤmodecol2 �� coll=1 � :=1 � coll=3 � :=3 � coll=15 � :=11 � coll=63 � :=3 "=� , 6ݤmodecol3 @� coll=1 � :=1 J� coll=3 � :=2 T� coll=15 � :=10 ^� coll=63 � :=12 h=� r |��findoutreal �#È™"Wimp_GetPointerInfo",,block% �mxco=block%!0:myco=block%!4 �!block%=main_handle% �#È™"Wimp_GetWindowState",,block% �%scrllx=block%!20:scrlly=block%!24 �mxco=mxco+(scrllx-block%!4) � myco=myco+(scrlly-block%!16) �found=0:counter=0 �� �counter+=1 �{� mxco>sqsizes(0,counter) � mxco<sqsizes(2,counter) � myco>sqsizes(1,counter) � myco<sqsizes(3,counter) � found=counter �� found<>0 � counter=63 �� found<>0 � icon%=found � icon%=64 � icon%=0 � icon%>64 � icon%-=65 � & 0��boardclick(icon%) :-� button%=1 � First<>-1 � �inter(icon%):� D� button%=1 � � NP� icon%=First � First<>-1 � First=-1:�setpieceflags(icon%,black):�clearint:� Xb� First=-1 � (square(icon%)=Go � square(icon%)=Go+2) � First=icon%:�setpieceflags(icon%,red):� b#� First<>-1 � square(icon%)=0 � lSecond=icon% v� �legal � �move �� �� � ���inter(icon%) �int(0)=First:lint=int(nint) �+� nint>0 � icon%=lint � �unint(icon%):� � set=� �!� square(First)>2 � d1=�:d2=� �!� square(First)=1 � d1=�:d2=� �!� square(First)=2 � d1=�:d2=� �� square(icon%)=0 � �9� icon%=lint-14 � �row(icon%)+2 = �row(lint) � d1=� � �� �opp(lint-7) � set=� � 9� icon%=lint-18 � �row(icon%)+2 = �row(lint) � d1=� � � �opp(lint-9) � set=� � *9� icon%=lint+14 � �row(icon%)-2 = �row(lint) � d2=� � 4� �opp(lint+7) � set=� >� H9� icon%=lint+18 � �row(icon%)-2 = �row(lint) � d2=� � R� �opp(lint+9) � set=� \� f� p� set � z�setpieceflags(icon%,green) �nint+=1 �int(nint)=icon% �� �� � ���clearint �� nint>0 � �� i=1 � nint � �setpieceflags(int(i),black) �� �� �nint=0:int()=0 �� ��unint(icon%) �setpieceflags(icon%,black) $int(nint)=0 .nint-=1 8� B Lݤlegal V!� square(First)>2 � d1=�:d2=� `!� square(First)=1 � d1=�:d2=� j!� square(First)=2 � d1=�:d2=� tok=� ~� nint=0 � �� inforce=� � � �B� Second-First=-7 � d1=� � �row(Second)+1 = �row(First) � ok=� �B� Second-First=-9 � d1=� � �row(Second)+1 = �row(First) � ok=� �A� Second-First=7 � d2=� � �row(Second)-1 = �row(First) � ok=� �A� Second-First=9 � d2=� � �row(Second)-1 = �row(First) � ok=� �� � �: �i� Second-First=-14 � d1=� � �row(Second)+2 = �row(First) � �opp(Second+7) � �deleteopp(Second+7):ok=� �i� Second-First=-18 � d1=� � �row(Second)+2 = �row(First) � �opp(Second+9) � �deleteopp(Second+9):ok=� �h� Second-First=14 � d2=� � �row(Second)-2 = �row(First) � �opp(Second-7) � �deleteopp(Second-7):ok=� h� Second-First=18 � d2=� � �row(Second)-2 = �row(First) � �opp(Second-9) � �deleteopp(Second-9):ok=� � � ok=� � :=� � nint=0 � :=0 (ok=� 2q� Second-int(nint)=-14 � d1=� � �row(Second)+2 = �row(int(nint)) � �opp(Second+7) � �deleteopp(Second+7):ok=� <q� Second-int(nint)=-18 � d1=� � �row(Second)+2 = �row(int(nint)) � �opp(Second+9) � �deleteopp(Second+9):ok=� Fp� Second-int(nint)=14 � d2=� � �row(Second)-2 = �row(int(nint)) � �opp(Second-7) � �deleteopp(Second-7):ok=� Pp� Second-int(nint)=18 � d2=� � �row(Second)-2 = �row(int(nint)) � �opp(Second-9) � �deleteopp(Second-9):ok=� Z� ok=� � :=0 d� i=1 � nint n7� int(i)-int(i-1)=-14 � d1=� � �deleteopp(int(i)+7) x7� int(i)-int(i-1)=-18 � d1=� � �deleteopp(int(i)+9) �6� int(i)-int(i-1)=14 � d2=� � �deleteopp(int(i)-7) �6� int(i)-int(i-1)=18 � d2=� � �deleteopp(int(i)-9) �� � �clearint �=� � �ݤopp(opchk) �� opchk<0 � opchk>63 � :=� �3� square(opchk)=Ogo � square(opchk)=Ogo+2 � :=� �=� � ���deleteopp(delcon) �square(delcon)=0 � thicondone=� � �setgoicon(�):�poll � finished% � �end "thicondone=� ,� 6nphuff=� @�setpiece(delcon,0) J� T ^ ��move h� thicondone=� � r�setgoicon(�):�poll |� finished% � �end �� �'� Go=1 � Second<8 � square(First)=3 �(� Go=2 � Second>55 � square(First)=4 � square(Second)=square(First) �square(First)=0 ��setpiece(First,0) ��setpieceflags(First,black) �$�setpiece(Second,square(Second)) � �setpieceflags(Second,black) �thicondone=� �� h=0�nphuff-1 �&� First=nhuff(h) � nhuff(h)=Second �� �countmen �justmoved � inforce � fdone=� &� 0 :��setupvarsndims Dconceded=� Nindim=� Xincomp=� biconclicked=� lphuff=0:nphuff=0 v nint=0 � hffd=� � inforce=� �inhuff=� �mainopen=� �finished%=� �instep=� �thicondone=� �Plyr1=0:Plyr2=0:level%=1 �pos=0:grld=0:playing%=� �First=-1:Second=-1 �dimension=0 �"Go=1:Ogo=2:Plyr1$="":Plyr2$="" �ld=5 � xcoord(63),ycoord(8) (� square(63),graphic$(255),numsq(31) @� store 16384,huff(11),grsizes(1,64),nhuff(11),sqsizes(3,63) � int(12) *G� quad(ld,12,63),bestpos(63),piece(ld),lev(ld),bscore(ld),score(ld) 4� bestpos2(63) >A� d1(ld),d2(ld),king(ld,12),maxlev(ld),oldnj(ld,12),nj(ld,12) H'� pjump(ld),tempscore(ld),pmove(ld) Rloaded=0 \� f p��vars3d zblack=&77000038 �red=&B7000038 �green=&A7000038 �yellow=&97000038 �mplayer1=134:mplayer2=137 �pcname1=133:pcname2=136 �goicon=158 �m1_icon=150:m2_icon=151 �k3_icon=152:k4_icon=153 �Gotexticon=157 �� � ���vars2d �black=&7700303A red=&B700303A green=&A700303A yellow=&9700303A $mplayer1=71:mplayer2=73 .pcname1=68:pcname2=70 8 goicon=72 Bm1_icon=96:m2_icon=98 Lk3_icon=97:k4_icon=99 VGotexticon=95 `� j t��checkifwon ~� m1=0 � k3=0 � �playing%=� �Q� �Plyr2$,1)="s" � won$="!"+Plyr2$+" have won!" � won$="!"+Plyr2$+" has won!" �0�alterIcon(main_handle%,Gotexticon,won$,0,1) �� �� m2=0 � k4=0 � �playing%=� �Q� �Plyr1$,1)="s" � won$="!"+Plyr1$+" have won!" � won$="!"+Plyr1$+" has won!" �0�alterIcon(main_handle%,Gotexticon,won$,0,1) �� �K� playing%=� � �greymenu(0,�,�):�alterIcon(main_handle%,goicon,"#",0,1) �� � ��greymenu(gr1,gr2,gr3) � gr1 � mainm!60=&7400021 � gr2 � mainm!156=&7400021 � gr3 � mainm!180=&7400021 (� 2 <$��keypressed(window%,icon%,key%) F1� window%=save_handle% � icon%=10 � key%=13 � P$�save(�gettext(save_handle%,10)) Z� dÈ™"Wimp_ProcessKey",key% n� x� � ���decodemenu �c=� � closeit=� �*� mencr%=-2 � block%!0=2 � finished%=� �� mencr%=main_handle% � �� block%!0=1 � �c=� � closeit=� ��greymenu(�,�,�) �steppos=pos-1 �spos=pos-1 �instep=� incomp=� playing%=�:�setgoicon(�) !�openwindow(stepthru_handle%) "� ,*� c=0 � block%!0=3 � �opengraphics:c=� 6:� c=0 � block%!0=4 � block%!4=0 � �setdimension(2):c=� @:� c=0 � block%!0=4 � block%!4=1 � �setdimension(3):c=� JA� c=0 � block%!0=5 � block%!4=0 � phuff<>0 � �huff:hffd=�:c=� TB� c=0 � block%!0=5 � block%!4=1 � phuff<>0 � �force:hffd=�:c=� ^%� c=0 � block%!0=6 � �concede:c=� h%� c=0 � block%!0=7 � �newgame:c=� r� |� hffd � hffd=�:� �#È™"Wimp_GetPointerInfo",,block% �� block%!8=1 � closeit=� � ��menucreate(mencr%) �� �� � � ��message �Ȏ block%!16 � �� 0:finished%=� �� 2:�save(�tidy(block%+44)) �@� 3:� block%!12=0 � block%!40=&560 � �load(�tidy(block%+44)) �� &502:�help � � &400C0: C� (mencr%=main_handle% � block%!32=0 � block%!36=1) � �opensave +� (mencr%=-2 � block%!32=1) � �opensave 8� (mencr%=main_handle% � block%!32=2) � �openplayers &� 0� : D��opengraphics N!block%=graphics_handle% X#È™"Wimp_GetWindowState",,block% b%xoffset=block%!4:yoffset=block%!8 l!block%=pane_handle% v#È™"Wimp_GetWindowState",,block% �block%!4=xoffset+16 �block%!8=yoffset+88 �block%!12=block%!4+204 �block%!16=block%!8+156 �ș"Wimp_OpenWindow",,block% �!block%=graphics_handle% �#È™"Wimp_GetWindowState",,block% �block%!28=pane_handle% �ș"Wimp_OpenWindow",,block% ��grclicked(lgrld-1) ��panemove(lgrld) �� � ! ��open ! � !block%=graphics_handle% � !%xoffset=block%!4:yoffset=block%!8 ! )xoffset2=block%!12:yoffset2=block%!16 !*!block%=pane_handle% !4#È™"Wimp_GetWindowState",,block% !>block%!4=xoffset+16 !Hblock%!8=yoffset+88 !Rblock%!12=block%!4+204 !\block%!16=block%!8+156 !fÈ™"Wimp_OpenWindow",,block% !p!block%=graphics_handle% !z#È™"Wimp_GetWindowState",,block% !�%block%!4=xoffset:block%!8=yoffset !�)block%!12=xoffset2:block%!16=yoffset2 !�block%!28=pane_handle% !�ș"Wimp_OpenWindow",,block% !�� !�ș"Wimp_OpenWindow",,block% !�� !�� !� !���close !�'� !block%=main_handle% � mainopen=� !� � !block%=graphics_handle% � !� È™"Wimp_CloseWindow",,block% "!block%=pane_handle% "� " È™"Wimp_CloseWindow",,block% "$� ". "8��setplyrnames "B3�alterIcon(main_handle%,pcname1,"#"+Plyr1$,0,1) "L3�alterIcon(main_handle%,pcname2,"#"+Plyr2$,0,1) "V� "` "jݤrow(rch) "t� rch<0 � :=rch+100 "~rch=(rch � 8) +1 "�� rch>0 � rch<9 � :=rch "�=(rch+100) "� "�6� �alterIcon(whandle%,ihandle%,text$,flgs%,redraw) "�Eblock%!0=whandle%:block%!4=ihandle%:È™"Wimp_GetIconState",,block% "�� �text$,1)="!" � "�!$block%!28=�text$,�(text$)-1) "�� "�� �text$,1)="#" � "�#$(block%+28)=�text$,�(text$)-1) "�[� flgs%=0 � È™"Wimp_DeleteIcon",,block%:block%!4=whandle%:È™"Wimp_CreateIcon",,block%+4 "�� # � flgs%<>0 � # È™"Wimp_DeleteIcon",,block% #block%!24=flgs% #block%!4=whandle% #(!È™"Wimp_CreateIcon",,block%+4 #2� #<� redraw=0 � � #FHÈ™"Wimp_ForceRedraw",whandle%,block%!8,block%!12,block%!16,block%!20 #P� #Z #d��ungreymenu(gr1,gr2,gr3) #n� gr1 � mainm!60=&7000021 #x� gr2 � mainm!156=&7000021 #�� gr3 � mainm!180=&7000021 #�� #� #� #�ݤtidy(loc%) #�tidy$="" #�� #�tidy$+=�(?loc%) #�loc%+=1 #�� ?loc%<32 #� =tidy$ #���loadgraphics(grfile$) #�� grfile$="" � � $A%=�grfile$ $present=A% $'lensp=�#A%:lensp+=((lensp-69000)*9) $"�#A% $,�� present=0 � �error("Unable to load graphics file - perhaps the Draughts disc is not present",�):!block%=graphics_handle%:�close:� $6È™"Hourglass_On" $@� inload=� � $J,È™"XOS_SpriteOp",256+25,sprites%,"board" $T �a=1�4 $^ �b=0�9 $h3È™"XOS_SpriteOp",256+25,sprites%,"square"+�a+�b $r�:� $|� $��slotsize(slotsize+lensp) $�� nslot<(slotsize+lensp) � $�v�error("Unable to allocate sufficient memory for graphics file - approximately "+�(lensp � 1024)+"k is needed.",0) $�#� inload=� � firstload=� � �end $�� $�4� nslot<(slotsize+lensp) � �slotsize(slotsize):� $�!sprites%+=lensp $�(È™"OS_SpriteOp",267,sprites%,grfile$ $�1È™"OS_SpriteOp",256+13,sprites%,block%,256,17 $�Plyr1$=�tidy(block%) $�1È™"OS_SpriteOp",256+13,sprites%,block%,256,18 $�Plyr2$=�tidy(block%) $�5È™"OS_SpriteOp",256+26,sprites%,Plyr1$,"square10" %5È™"OS_SpriteOp",256+26,sprites%,Plyr2$,"square20" %Plyr1$=�Plyr1$,�(Plyr1$)-2) %Plyr2$=�Plyr2$,�(Plyr2$)-2) %&� a=1�4 %0<È™"OS_SpriteOp",256+40,sprites%,"square"+�a+"0" � ,,,w,h %:� b=1�8 %DOgrsizes(0,(a*10)+b)=2*(w*((16+b)/24)):grsizes(1,(a*10)+b)=4*(h*((16+b)/24)) %NSÈ™"OS_SpriteOp",256+15,sprites%,"square"+�a+�b,0,w*((16+b)/24),h*((16+b)/24),12 %X2È™"OS_SpriteOp",256+29,sprites%,"square"+�a+�b %b2È™"OS_SpriteOp",256+60,sprites%,"square"+�a+�b %l!block%=16+b:block%!4=16+b %v %�block%!8=24:block%!12=24 %�@È™"OS_SpriteOp",256+52,sprites%,"square"+�a+"0",0,0,0,block% %�2È™"OS_SpriteOp",256+61,sprites%,"square"+�a+�b %��0 %�GÈ™"OS_SpriteOp",256+52,sprites%,"square"+�a+"0",0,0,&8,block%,pixel %�� %�� %�%È™"OS_SpriteOp",256+60,sprites%,0 %�loaded=lgrld %��setplyrnames %�8bdimens=dimension:dimension=0:�setdimension(bdimens) %�ș"Hourglass_Off" %�� & &��startdrag &!block%=save_handle% & #È™"Wimp_GetWindowState",,block% &*ysize%=block%!16-block%!8 &4x%=block%!4:y%=block%!8 &>block%!4=0 &H!È™"Wimp_GetIconState",,block% &R !block%=0 &\block%!4=5 &fblock%!8+=x% &pblock%!12+=y%+ysize% &zblock%!16+=x% &�block%!20+=y%+ysize% &�block%!24=0 &�block%!28=0 &�,È™"OS_ReadModeVariable",-1,4 � ,,xtentsh &�,È™"OS_ReadModeVariable",-1,5 � ,,ytentsh &�+È™"OS_ReadModeVariable",-1,11 � ,,xtent &�+È™"OS_ReadModeVariable",-1,12 � ,,ytent &�%block%!32=((xtent+1)*2^xtentsh)-1 &�%block%!36=((ytent+1)*2^ytentsh)-1 &�ș"Wimp_DragBox",,block% &�� &� &���dragdone '#È™"Wimp_GetPointerInfo",,block% '!block%=60 'block%!20=block%!12 '$block%!12=0 '.block%!24=block%!16 '8block%!16=1 'Bblock%!28=!block% 'Lblock%!32=block%!4 'Vblock%!40=&560 '`4$(block%+44)=�lastbit(�gettext(save_handle%,10)) 'j,È™"Wimp_SendMessage",17,block%,block%!20 't� '~ '�ݤlastbit(lb$) '�lbr$="":lbc=0 '�� '� lbc+=1 '�lbr$=�lb$,lbc) '�#� �lbr$,1)="." � �(lbr$)=�(lb$) '�(� �lb$,lbc)="." � :=�lbr$,�(lbr$)-1) '� =lbr$ '� '���save(savename$) '�Y� �savename$,".")<1 � �error("To save, drag the file icon to a directory viewer",�):� '�ș"Hourglass_On" ( A%=�savename$ ( �#A%,dimension (�#A%,Go (�#A%,Plyr1 ((�#A%,Plyr2 (2�#A%,level% (<�#A%,graphic$(lgrld); (F%�#A%,�10-�(graphic$(lgrld)),"."); (P�#A%,pos (Z� p=0�(pos*44)-1 (d�#A%,store?p (n� (x�#A% (� �"settype "+savename$+" 560" (�ș"Hourglass_Off" (�-� iconclicked=� � È™"Wimp_CreateMenu",,-1 (�filename$=savename$ (�1�alterIcon(save_handle%,10,"!"+filename$,0,1) (�� (� (� ��concede (�playing%=� (�conceded=� (��greymenu(0,�,�) (�&� Go=1 � Gcn$=Plyr1$ � Gcn$=Plyr2$ (�9� �Gcn$,1)="s" � Gcn$+=" concede" � Gcn$+=" concedes" )4�alterIcon(main_handle%,Gotexticon,"!"+Gcn$,0,1) )+�alterIcon(main_handle%,goicon,"#",0,1) ) Go+=2 )"� ), )6 ��newgame )@conceded=� )JÈ™"Hourglass_On" )Tincomp=� )^7� instep � instep=�:!block%=stepthru_handle%:�close )hplaying%=� )r@�restore(0):È™"Wimp_ForceRedraw",main_handle%,0,-1024,1280,0 )|�ungreymenu(�,�,�) )�ș"Hourglass_Off" )�� )� )���checkifhuff )�nhuff()=0:nphuff=0 )�� s=0 � 63 )�6� square(s)<>0 � (square(s)=Go � square(s)=Go+2) � )�si=square(s) )�� si=1 � d1=�:d2=� )�� si=2 � d1=�:d2=� )�� si>2 � d1=�:d2=� )�'� (�row(s)-2 = �row(s-14)) � d1=� � )�.� square(s-14)=0 � �opp(s-7) � �addhuff(s) *� *'� (�row(s)-2 = �row(s-18)) � d1=� � *.� square(s-18)=0 � �opp(s-9) � �addhuff(s) *&� *0'� (�row(s)+2 = �row(s+14)) � d2=� � *:.� square(s+14)=0 � �opp(s+7) � �addhuff(s) *D� *N'� (�row(s)+2 = �row(s+18)) � d2=� � *X.� square(s+18)=0 � �opp(s+9) � �addhuff(s) *b� *l� *v� *�� *� *���addhuff(s) *� already=� *�� h=0 � nphuff-1 *�� nhuff(h)=s � already=� *�� *�� already � � *�nhuff(nphuff)=s *� nphuff+=1 *�� *� *� ��huff +inhuff=� +setphuff=� +!block%=graphics_handle% + �close +*È™"Wimp_CreateMenu",,-1 +4 done=� +>&� Go=1 � HGo$=Plyr2$ � HGo$=Plyr1$ +H9�alterIcon(main_handle%,Gotexticon,"!Huff "+HGo$,0,1) +R� h=0�phuff-1 +\"�setpieceflags(huff(h),yellow) +f� +p6� First<>-1 � �setpieceflags(First,black):First=-1 +z �clearint +�� +�(È™"Wimp_Poll",mask%,block% � reason% +�Ȏ reason% � +�#� 2:È™"Wimp_OpenWindow",,block% +�$� 3:È™"Wimp_CloseWindow",,block% +�0� 6:�huffclick(block%!8,block%!12,block%!16) +�� 9:�huffmenu +�� 17,18:�huffmessage +�� +�� finished% �end +� � done +�� h=0 � phuff-1 +�!�setpieceflags(huff(h),black) ,� ,� setphuff � phuff=� ,�setgotext ,$ �countmen ,.�checkifhuff ,8inhuff=� ,B� ,L ,V&��huffclick(button%,window%,icon%) ,`� button%=2 � ,j<� window%=-2 � È™"Wimp_CreateMenu",,barm,block%!0-64,228 ,tP� window%=main_handle% � È™"Wimp_CreateMenu",,canchm,block%!0-64,block%!4-16 ,~mencr%=window% ,�� ,�� button% <> 4 � � ,�,� window%=-2 � �openwindow(main_handle%) ,�� window%=main_handle% � ,�ok=� ,�#� dimension=2 � icon%<64 � ok=� ,�$� dimension=3 � icon%<129 � ok=� ,� � ok � ,�!� dimension=3 � �findoutwhich ,�� icon%<64 � icon%>0 � ,�found=-1 ,�� h=0 � phuff-1 - #� icon%=huff(h) � found=huff(h) - � -� found<>-1 � -�lightningbolt(found) -(square(found)=0 -2 done=� -<setphuff=� -F� -P� -Z� -d� -n� -x -���huffmenu -�$� mencr%=main_handle% � done=�:� -�*� mencr%=-2 � block%!0=2 � finished%=� -�#È™"Wimp_GetPointerInfo",,block% -�<� block%!8=1 � È™"Wimp_CreateMenu",,barm,block%!0-64,228 -�� -� -���huffmessage -�Ȏ block%!16 � -�� 0:finished%=� -�� 2:�save(�tidy(block%+44)) -�G� 3:� block%!12=0 � block%!40=&560 � �load(�tidy(block%+44)):done=� -�� &502:�help . � &400C0: .C� (mencr%=main_handle% � block%!32=0 � block%!36=1) � �opensave .+� (mencr%=-2 � block%!32=1) � �opensave ."8� (mencr%=main_handle% � block%!32=2) � �openplayers .,� .6� .@ .J��lightningbolt(licon%) .T� dimension=3 � licon%+=65 .^!block%=main_handle% .hblock%!4=licon% .r!È™"Wimp_GetIconState",,block% .|)exp=block%!8+((block%!16-block%!8)/2) .�wyp=block%!12 .�!block%=main_handle% .�block%!4=exp-36 .�block%!8=wyp+220 .�block%!12=block%!4+104 .�block%!16=block%!8+64 .�block%!20=-956276710 .�$(block%+24)="cloud" .�&È™"Wimp_CreateIcon",,block% � cldh .�(�alterIcon(main_handle%,cldh,"",0,1) .��poll:� finished% �end .�!block%=main_handle% .�block%!4=exp-20 /block%!8=wyp+24 /block%!12=block%!4+32 /block%!16=block%!8+200 /&block%!20=-956276710 /0$(block%+24)="lightning" /:&È™"Wimp_CreateIcon",,block% � lgth /D(�alterIcon(main_handle%,lgth,"",0,1) /N�poll:� finished% �end /Xtime=�:���>time+10 /b�setpiece(found,0) /l�poll:� finished% �end /vtime=�:���>time+20 /�)�alterIcon(main_handle%,lgth,"#",0,1) /�!block%=main_handle% /�block%!4=lgth /�ș"Wimp_DeleteIcon",,block% /��poll:� finished% �end /�time=�:���>time+10 /�)�alterIcon(main_handle%,cldh,"#",0,1) /�!block%=main_handle% /�block%!4=cldh /�ș"Wimp_DeleteIcon",,block% /��poll:� finished% �end /�� /� 0��force 0fpos=pos 0 inforce=� 0 !block%=graphics_handle% 0* �close 04È™"Wimp_CreateMenu",,-1 0>fdone=� 0H&� Go=1 � FGo$=Plyr2$ � FGo$=Plyr1$ 0R6� First<>-1 � �setpieceflags(First,black):First=-1 0\ �clearint 0fÈ™"Hourglass_On" 0p�restore(pos-2) 0zÈ™"Hourglass_Off" 0�:�alterIcon(main_handle%,Gotexticon,"!Force "+FGo$,0,1) 0�� 0�(È™"Wimp_Poll",mask%,block% � reason% 0�Ȏ reason% � 0�#� 2:È™"Wimp_OpenWindow",,block% 0�$� 3:È™"Wimp_CloseWindow",,block% 0�1� 6:�forceclick(block%!8,block%!12,block%!16) 0�� 9:�forcemenu 0�� 17,18:�huffmessage 0�� 0�� finished% �end 0�� fdone 0� inforce=� 1� 1 1'��forceclick(button%,window%,icon%) 1$� button%=2 � 1.<� window%=-2 � È™"Wimp_CreateMenu",,barm,block%!0-64,228 18P� window%=main_handle% � È™"Wimp_CreateMenu",,cancfm,block%!0-64,block%!4-16 1Bmencr%=window% 1L� 1V� button%=2 � � 1`8� window%=-2 � button%=4 � �openwindow(main_handle%) 1j� window%=main_handle% � 1tok=� 1~#� dimension=2 � icon%<64 � ok=� 1�$� dimension=3 � icon%<129 � ok=� 1� � ok � 1�!� dimension=3 � �findoutwhich 1�.� icon%<64 � icon%>-1 � �boardclick(icon%) 1�� 1�� 1�� 1� 1���forcemenu 1�� mencr%=main_handle% � 1�fdone=� 1�ș"Hourglass_On" 2 �restore(fpos-1) 2 È™"Hourglass_Off" 2� 2� mencr%=main_handle% � � 2(*� mencr%=-2 � block%!0=2 � finished%=� 22#È™"Wimp_GetPointerInfo",,block% 2<<� block%!8=1 � È™"Wimp_CreateMenu",,barm,block%!0-64,228 2F� 2P 2Z ��help 2d%window%=block%!32:icon%=block%!36 2n%block%!12=block%!8:block%!16=&503 2xtext%=block%+20 2�0$text%="This is the Draughts application.|M" 2�Ȏ window% � 2��� -2:$text%="Click Select over this icon to open the main playing window.|MClick Menu over this icon to open the icon bar menu for Draughts.|M" 2�� main_handle%: 2�<� (dimension=3 � icon%<129) � (dimension=2 � icon%<64) � 2�-text$="This is the main playing board.|M" 2�� inhuff=� � 2��� First=-1 � text$+="Click Select over the piece which you wish to move. The square on which it rests will be highlighted red. If you change your mind, click Select over the piece a second time.|M" 2��� First<>-1 � text$+="Click Select over the square to which you wish your piece to move. If you wish to make multiple jumps, use Adjust to select the intermediate squares, which will be highlighted green.|M" 2�� 2�text$+="Click Select over any one of the pieces on a yellow square - that piece will then be huffed. To cancel the operation, use the main menu.|M" 2�� 2�$text%=text$ 3� 3� pane_handle%: 3K$text%="Click on the graphics file you wish to load, then select OK.|M" 3"� graphics_handle% 3,N� icon%>0 � $text%="Selecting OK will load the specified graphics file.|M" 36� save_handle%: 3@H� icon%=0 � $text%="Drag this icon to a directory viewer to save.|M" 3JJ� icon%=9 � $text%="Selecting OK will save the current game status.|M" 3TW� icon%=10 � $text%="Enter the filename in this icon, then press Return to save.|M" 3^� players_handle%: 3hÈŽ icon% � 3rV� 18:$text%="This icon shows the skill level of the computer player(s), if any.|M" 3|h� 19:$text%="Selecting this icon will decrease the skill level of the computer player(s), if any.|M" 3�h� 20:$text%="Selecting this icon will increase the skill level of the computer player(s), if any.|M" 3�� 3: 3�E� Plyr1=0 � P1$="user":P2$="computer" � P1$="computer":P2$="user" 3�Z$text%="Selecting this icon will change player one from "+P1$+" to "+P2$+" control.|M" 3�� 7: 3�E� Plyr2=0 � P1$="user":P2$="computer" � P1$="computer":P2$="user" 3�Z$text%="Selecting this icon will change player two from "+P1$+" to "+P2$+" control.|M" 3�� 3�� stepthru_handle%: 3�Ȏ icon% � 3�D� 0:$text%="This icon resets the board to the first position.|M" 3�A� 1:$text%="This icon moves the game status back one move.|M" 3�Y� 2:$text%="This icon sets the current game status to that shown and resumes play.|M" 4D� 3:$text%="This icon moves the game status forward one move.|M" 4L� 4:$text%="This icon resets the board to the last position recorded.|M" 4� 4&� 40!block%=(�$text%+25)��3 4:+È™"Wimp_SendMessage",17,block%,block%!4 4D� 4N 4Xݤnextdepth(depth) 4bbscore(depth)=-100 4lpjump(depth)=� 4v� piece(depth)=0 � 31 4��poll:� finished% �end 4�#� incomp=� � piece(depth)=31:=0 4�score(depth)=0 4�d� quad(depth,1,numsq(piece(depth)))=�go(depth) � quad(depth,1,numsq(piece(depth)))=�kgo(depth) � 4�#�dir(depth,numsq(piece(depth))) 4�Hmaxlev(depth)=0:lev(depth)=1:�checkifjump(numsq(piece(depth)),depth) 4�� 4�� 4� 4�&� pjump(depth)=� � :=bscore(depth) 4�"� depth=level% � depth>2 � :=0 4�bscore(depth)=-100 4�� piece(depth)=0 � 31 5�poll:� finished% �end 5#� incomp=� � piece(depth)=31:=0 5score(depth)=0 5 d� quad(depth,1,numsq(piece(depth)))=�go(depth) � quad(depth,1,numsq(piece(depth)))=�kgo(depth) � 5*#�dir(depth,numsq(piece(depth))) 54+�checkifmove(numsq(piece(depth)),depth) 5>� 5H� 5R 5\� pjump(depth)=� � :=-500 5f=bscore(depth) 5p 5z��dir(depth,pc) 5� dGo=0 5�� (depth � 1)=1 � dGo=Go 5�� dGo=0 � Go=2 � dGo=1 5�� dGo=0 � Go=1 � dGo=2 5�!� quad(depth,1,pc)>2 � dGo+=2 5�%� dGo=1 � d1(depth)=�:d2(depth)=� 5�%� dGo=2 � d2(depth)=�:d1(depth)=� 5�%� dGo>2 � d1(depth)=�:d2(depth)=� 5�� 5� 5�ݤgo(depth) 5� dGo=0 5�� (depth � 1)=1 � dGo=Go 6� dGo=0 � Go=2 � dGo=1 6� dGo=0 � Go=1 � dGo=2 6=dGo 6$ 6.ݤkgo(depth) 68 dGo=0 6B� (depth � 1)=1 � dGo=Go 6L� dGo=0 � Go=2 � dGo=1 6V� dGo=0 � Go=1 � dGo=2 6` =dGo+2 6j 6t��checkifjump(piece,depth) 6~king(depth,lev(depth))=� 6�2oldnj(depth,lev(depth))=nj(depth,lev(depth)-1) 6�/nj(depth,lev(depth))=nj(depth,lev(depth)-1) 6�2� �row(piece)-2 = �row(piece-14) � d1(depth) � 6�@� quad(depth,lev(depth),piece-14)=0 � �copp(depth,piece-7) � 6�\� quad(depth,lev(depth),piece)=1 � (piece-14>-1 � piece-14<8) � king(depth,lev(depth))=� 6�R� q=0 � 31:quad(depth,lev(depth)+1,numsq(q))=quad(depth,lev(depth),numsq(q)):� 6�Bquad(depth,lev(depth)+1,piece-14)=quad(depth,lev(depth),piece) 6�>� king(depth,lev(depth)) � quad(depth,lev(depth),piece)+=2 6�Gquad(depth,lev(depth)+1,piece-7)=0:quad(depth,lev(depth)+1,piece)=0 6�2nj(depth,lev(depth))=oldnj(depth,lev(depth))+1 6�lev(depth)+=1 6� �checkifjump(piece-14,depth) 7 lev(depth)-=1 7 king(depth,lev(depth))=� 7pjump(depth)=� 7� 7(� 72: 7<2� �row(piece)-2 = �row(piece-18) � d1(depth) � 7F@� quad(depth,lev(depth),piece-18)=0 � �copp(depth,piece-9) � 7P\� quad(depth,lev(depth),piece)=1 � (piece-18>-1 � piece-18<8) � king(depth,lev(depth))=� 7ZR� q=0 � 31:quad(depth,lev(depth)+1,numsq(q))=quad(depth,lev(depth),numsq(q)):� 7dBquad(depth,lev(depth)+1,piece-18)=quad(depth,lev(depth),piece) 7nGquad(depth,lev(depth)+1,piece-9)=0:quad(depth,lev(depth)+1,piece)=0 7x2nj(depth,lev(depth))=oldnj(depth,lev(depth))+1 7�lev(depth)+=1 7� �checkifjump(piece-18,depth) 7�lev(depth)-=1 7�king(depth,lev(depth))=� 7�pjump(depth)=� 7�� 7�� 7�: 7�2� �row(piece)+2 = �row(piece+14) � d2(depth) � 7�@� quad(depth,lev(depth),piece+14)=0 � �copp(depth,piece+7) � 7�]� quad(depth,lev(depth),piece)=2 � (piece+14>55 � piece+14<64) � king(depth,lev(depth))=� 7�R� q=0 � 31:quad(depth,lev(depth)+1,numsq(q))=quad(depth,lev(depth),numsq(q)):� 7�Bquad(depth,lev(depth)+1,piece+14)=quad(depth,lev(depth),piece) 8Gquad(depth,lev(depth)+1,piece+7)=0:quad(depth,lev(depth)+1,piece)=0 82nj(depth,lev(depth))=oldnj(depth,lev(depth))+1 8lev(depth)+=1 8" �checkifjump(piece+14,depth) 8,lev(depth)-=1 86king(depth,lev(depth))=� 8@pjump(depth)=� 8J� 8T� 8^: 8h2� �row(piece)+2 = �row(piece+18) � d2(depth) � 8r@� quad(depth,lev(depth),piece+18)=0 � �copp(depth,piece+9) � 8|]� quad(depth,lev(depth),piece)=2 � (piece+18>55 � piece+18<64) � king(depth,lev(depth))=� 8�R� q=0 � 31:quad(depth,lev(depth)+1,numsq(q))=quad(depth,lev(depth),numsq(q)):� 8�Bquad(depth,lev(depth)+1,piece+18)=quad(depth,lev(depth),piece) 8�Gquad(depth,lev(depth)+1,piece+9)=0:quad(depth,lev(depth)+1,piece)=0 8�2nj(depth,lev(depth))=oldnj(depth,lev(depth))+1 8�lev(depth)+=1 8� �checkifjump(piece+18,depth) 8�lev(depth)-=1 8�king(depth,lev(depth))=� 8�pjump(depth)=� 8�� 8�� 8�: 8�C� lev(depth)>1 � oldnj(depth,lev(depth))=nj(depth,lev(depth)) � 9!tempscore(depth)=lev(depth)+1 94� king(depth,lev(depth)-1) � tempscore(depth)+=1 99� (depth � 1)=0 � tempscore(depth)=tempscore(depth)*2 9&� depth<level% � 90� q=0�31 9:<quad(depth+1,1,numsq(q))=quad(depth,lev(depth),numsq(q)) 9D� 9N)tempscore(depth)-=�nextdepth(depth+1) 9X� 9bR� tempscore(depth)>bscore(depth) � (tempscore(depth)=bscore(depth) � �(2)=2) � 9l"bscore(depth)=tempscore(depth) 9v� depth=1 � 9�� q=0�63 9�bestpos(q)=quad(1,lev(1),q) 9�� 9�� 9�� 9�� 9�� 9� 9���checkifmove(piece,depth) 9�"king(depth,1)=�:pmove(depth)=� 9� 9�1� �row(piece)-1 = �row(piece-7) � d1(depth) � 9�� quad(depth,1,piece-7)=0 � :H� quad(depth,1,piece)=1 � (piece-7>-1 � piece-7<8) � king(depth,1)=� :score(depth)=.5 :&� king(depth,1) � score(depth)+=.4 : 1� (depth � 1)=0 � score(depth)=score(depth)*2 :*� depth<level% � depth=1 � :4� q=0 � 31 :>3quad(depth+1,1,numsq(q))=quad(depth,1,numsq(q)) :H� :R1quad(depth+1,1,piece-7)=quad(depth+1,1,piece) :\quad(depth+1,1,piece)=0 :f0� king(depth,1) � quad(depth+1,1,piece-7)+=2 :p :z :� :�6� depth<level% � score(depth)-=�nextdepth(depth+1) :�� :�X� ((score(depth)>bscore(depth)) � (score(depth)=bscore(depth) � �(2)=2)) � depth=1 � :�bscore(depth)=score(depth) :�� q=0 � 31 :�.bestpos(numsq(q))=quad(depth+1,1,numsq(q)) :�� :�� :�!pjump(depth)=�:pmove(depth)=� :�king(depth,1)=� :�� :�� ;: ;1� �row(piece)-1 = �row(piece-9) � d1(depth) � ;� quad(depth,1,piece-9)=0 � ;$H� quad(depth,1,piece)=1 � (piece-9>-1 � piece-9<8) � king(depth,1)=� ;.score(depth)=.5 ;8&� king(depth,1) � score(depth)+=.4 ;B1� (depth � 1)=0 � score(depth)=score(depth)*2 ;L� depth<level% � depth=1 � ;V� q=0 � 31 ;`3quad(depth+1,1,numsq(q))=quad(depth,1,numsq(q)) ;j� ;t1quad(depth+1,1,piece-9)=quad(depth+1,1,piece) ;~quad(depth+1,1,piece)=0 ;�0� king(depth,1) � quad(depth+1,1,piece-9)+=2 ;�6� depth<level% � score(depth)-=�nextdepth(depth+1) ;�� ;�X� ((score(depth)>bscore(depth)) � (score(depth)=bscore(depth) � �(2)=2)) � depth=1 � ;�bscore(depth)=score(depth) ;�� q=0 � 31 ;�.bestpos(numsq(q))=quad(depth+1,1,numsq(q)) ;�� ;�� ;�!pjump(depth)=�:pmove(depth)=� ;�king(depth,1)=� ;�� <