home *** CD-ROM | disk | FTP | other *** search
- 1 poke53281,0:poke53280,0:poke788,52
- 2 dv=peek(186):i=rnd(-ti)
- 5 sys57812"resource $1c80",dv,0:poke780,0:poke781,128:poke782,28:sys65493
- 6 sys57812"morris ml$c000",dv,0:poke780,0:poke781,0:poke782,192:sys65493
- 9 rem*
- 10 rem*************************
- 20 rem* nine men's morris v1.0
- 30 rem* by: robert mundschau
- 40 rem* last modified 09/15/95
- 50 rem*************************
- 60 rem*
- 99 rem** main caller
- 100 gosub 1000:rem* initialize
- 110 gosub 2000:rem* draw title
- 120 gosub 2500:rem* main menu
- 130 rem* handle main menu selection
- 140 if m=3 then sys49162:gosub9200:goto110:rem*display game rules
- 150 if m=4 then goto 900:rem*loadstar
- 199 rem* m=2 start game
- 200 gosub 3000:rem* pre-game set-up
- 209 rem* main game loop
- 210 lt=ct:ct=(ct+1)and1:gosub9300
- 220 ifnp(ct)=0then8700:rem*patched code
- 299 rem* yes, place a piece.
- 300 w1=2:gosub9400:poke1539,176+np(ct):rem* dsply # left
- 310 on (pt(ct)+1) gosub 4000,5000
- 320 sp%(sn%(cx,cy))=ct:np(ct)=np(ct)-1
- 330 gosub8100:gosub9600:rem*appear
- 340 goto500
- 399 rem* move a piece. (patch return)
- 400 w1=8:gosub9400:rem* dsply your move
- 405 on (pt(ct)+1) gosub 4200,6000
- 410 ifk<>4then430:rem* move was made
- 415 gosub8050:gosub9300:w1=11:gosub9400:gosub9200:gosub9300:goto400:rem* cancel
- 420 goto8700:rem* entrapment scan
- 429 rem*animate move
- 430 gosub9350:sp%(sn%(cx,cy))=2:gosub8900:sp%(sn%(ma(k,0),ma(k,1)))=ct
- 435 poke2040,sb+4:gosub9650
- 440 gosub8200:fort=4to1step-1:poke2040,sb+t:pokes+1,t*3:forw1=1to50:next:next
- 450 w1=(ma(k,0)-cx)*2:w2=(ma(k,1)-cy)*2:rem* dot velocity
- 460 fort=12to1step-1:pokes+1,t:pokev,peek(v)+w1:pokev+1,peek(v+1)+w2:next
- 470 fort=2to4:poke2040,sb+t:forw1=1to75:next:next
- 480 cx=ma(k,0):cy=ma(k,1):gosub9650:poke2040,sb+5
- 499 rem* check if mill formed
- 500 w1=sn%(cx,cy):m%=0
- 510 if(sp%(as%(w1,0))=ct)and(sp%(as%(w1,1))=ct)thenm%=m%+1
- 520 if(sp%(as%(w1,2))=ct)and(sp%(as%(w1,3))=ct)thenm%=m%+1
- 550 if m%=0 then680:rem* no mill
- 599 rem* player formed a mill
- 600 gosub8300:gosub9300:w1=5:gosub9400:rem* dsply you have formed a mill.
- 610 on(pt(ct)+1)gosub 4500,7000
- 620 sp%(sn%(cx,cy))=2:rem* remove piece
- 630 gosub8150:gosub9950:rem* animate
- 640 m%=m%-1:ifm%>0then600
- 649 rem* check for winner
- 650 gosub9700:rem* piece count
- 660 if(w1+np(0))<3thenqf=1:goto700:rem* moon win
- 670 if(w2+np(1))<3thenqf=1:goto800:rem* sun win
- 679 rem* has q been pressed
- 680 if qf>0 then on (lt+1) goto 800,700
- 690 goto210:rem* next player
- 699 rem* moons win
- 700 gosub9000:poke53280,0:gosub8500:printc$(1)pp$(1):w1$=left$(l$,12)
- 710 print"[153]"w1$" the moon has":printw1$"eclipsed the sun"
- 720 printw1$"in their contest":printw1$" for the sky!"
- 730 goto825
- 799 rem* suns win
- 800 gosub9000:poke53280,6:gosub8500:printc$(0)pp$(0):w1$=left$(l$,11)
- 810 poke53281,6:print"[153]"w1$"hip! hip! hooray!":printw1$" the sun"
- 820 printw1$" has won the":printw1$" day!"
- 825 print"press fire or return"
- 830 gosub9050:gosub9200:gosub8100:goto110
- 899 rem* return to loadstar
- 900 w1$=left$(l$,19):print"[147]"w1$c$(0)pp$(0)
- 910 print"[155]do you wish to return to loadstar?"
- 920 printw1$"[157][157]([153]y[155]/[150]n[155])?":printw1$c$(1)pp$(1)
- 930 getm$:ifm$="n"then110
- 940 ifm$<>"y"then930
- 950 print"[147][154]thank-you for playing 9 men's morris."
- 960 print"[153]please check that the disk is ready and"
- 965 print"then press return."
- 970 gosub 9200:sys49432:rem* irqs off
- 980 poke53272,peek(53272)and240or4:poke44,8:poke43,1:poke2048,0
- 990 goto40000
- 999 rem* initialize
- 1000 print"[147]";:poke53272,peek(53272)and240or14
- 1010 l$="":d$=""
- 1020 fort=0to10step2:print""left$(d$,t);:fork=0to(22-t):poke646,t*2+7
- 1030 w1$=left$(l$,t)+left$("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",40-t*2)
- 1040 fork=0to(22-t*2):printw1$:next:next
- 1050 print""left$(l$,11)left$(d$,11)"[159] setting up... "
- 1059 rem*
- 1060 sys 49206:rem* engage irqs
- 1065 rem*
- 1070 dim gb%(7,7),mf%(7,7),sn%(7,7),as%(24,3),sp%(24),xy%(24,1),pf%(18,1)
- 1075 dim ps%(35),cf%(35),cl%(24),ts%(24),mr%(13,17)
- 1080 dim jv(31),jx(4),jy(4),pt(1),ma(4,1),np(1)
- 1090 dim ms$(13),mc$(1),c$(3),cs$(1),pp$(3),pt$(1)
- 1100 mc$(0)="[158]":mc$(1)="[159]":rem* text window color and rvs.
- 1110 c$(0)="[158]":c$(1)="[159]"
- 1120 pp$(0)="[192][193][157][157][160][161]":pp$(1)="[200][201][157][157][168][169]":pp$(2)=" [157][157] ":pp$(3)=""
- 1130 pt$(0)="[155] person ":pt$(1)="[155]computer"
- 1140 cs$(0)="[153]novice":cs$(1)="[129] best "
- 1150 mm$(0)="player selection":mm$(1)="computer skill"
- 1160 mm$(2)="start game":mm$(3)="game rules":mm$(4)="return to loadstar"
- 1170 fort=0to31:jv(t)=4:next:jv(30)=0:jv(29)=2:jv(27)=3:jv(23)=1
- 1180 jx(1)=1:jx(3)=-1:jy(0)=-1:jy(2)=1:qf=1
- 1199 rem* sprite set-up
- 1200 sb=150:v=53248
- 1210 pokev+21,1:pokev+16,0:pokev+28,0:pokev+23,30:pokev+27,0:pokev+29,30
- 1299 rem* sound set-up
- 1300 s=54272:fort=0to24:pokes+t,0:next
- 1310 pokes+24,15
- 1399 rem* read data
- 1400 forcy=0to7:forcx=0to7:readw1:gb%(cx,cy)=w1:next:next
- 1410 forcy=0to6:forcx=0to6:readw1:mf%(cx,cy)=w1:next:next
- 1420 forcy=0to6:forcx=0to6:readw1:sn%(cx,cy)=w1:next:next
- 1430 forcy=0to6:forcx=0to6:w1=sn%(cx,cy):xy%(w1,0)=cx:xy%(w1,1)=cy:next:next
- 1439 rem* unpack strings
- 1440 fort=0to13:read w1$:w1=len(w1$):w2=1
- 1450 ms$(t)=ms$(t)+mid$(w1$,w2,12)+"[157][157][157][157][157][157][157][157][157][157][157][157]":w2=w2+12:ifw2<w1then1450
- 1460 next
- 1480 fort=1to24:fork=0to3:readw1:as%(t,k)=w1:next:next
- 1490 fort=0to18:fork=0to1:readw:pf%(t,k)=w:next:next
- 1500 fort=0to35:readw:ps%(t)=w:next
- 1510 fort=0to35:readw:cf%(t)=w:next
- 1520 fort=1to24:readw:ts%(t)=w:next
- 1530 fort=0to17:fork=0to13:readw:mr%(k,t)=w:next:next
- 1990 return
- 1999 rem* draw title
- 2000 gosub9000:print"[147]":poke53280,0:poke53281,0:pokev+21,0
- 2010 w1$=""
- 2020 printw1$"[220][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][223][221]"
- 2030 printw1$"[255][158][207][208][146] [209][210][211][212][213][214][215][216][217]";
- 2040 print"[146] [209][210][218][219][220][221][220][221][255][223][216][217][146][191]"
- 2050 printw1$"[255][159][175][176][146] [177][178][179][180][181][182][183][184][185]";
- 2060 print"[146] [177][178][186][187][188][189][188][189][190][191][184][185][146][191]"
- 2070 printw1$"[188][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][190][189]"
- 2100 w2$=left$(l$,10):printw2$"by: robert mundschau"
- 2110 printw1$c$(0)pp$(0)w2$"menu[145]"w2$c$(1)pp$(1)
- 2120 printw2$"<"w1$w2$">"
- 2130 printw2$"<"w1$w2$">"
- 2140 printw1$c$(0)pp$(0)w1$w1$w1$w1$"[145]"c$(1)pp$(1)
- 2150 print"use [153]joy2 or [153]crsr keys and [153]return"
- 2160 printw1$"to make your selections.";
- 2170 return
- 2499 rem* main menu
- 2500 m=0:gosub2900:gosub9050
- 2510 gosub2900:gosub9100
- 2520 if(cr=1)and(m>1)then:gosub8250:return
- 2530 on j goto 2560,2540,2560,2510
- 2540 m=m+jy(j):if(m<0)or(m>4)thenm=m-jy(j)
- 2550 goto2510
- 2560 on (m+1) goto 2700,2600,2510,2510,2510
- 2600 cs=(cs+1)and1:gosub8250:goto2510
- 2700 ifj=3thenpt(0)=(pt(0)+1)and1:goto2720
- 2710 pt(1)=(pt(1)+1)and1:ifpt(1)+pt(0)=2thenpt(0)=0:goto2730
- 2720 if pt(1)+pt(0)=2thenpt(1)=0
- 2730 gosub8250:goto2510
- 2899 rem* update menu
- 2900 print""pt$(pt(0))""pt$(pt(1))
- 2910 print""cs$(cs)""cs$(cs)"[145][145][145][145]"
- 2920 fort=0to4:w2$="[156]":ifm=tthenw2$=c$(p):p=(p+1)and1
- 2930 print w2$:print""mm$(t):next:return
- 2999 rem** pre-game setup
- 3000 gosub9000:poke53280,2
- 3010 sys 49157:rem* draw gameboard
- 3020 sp%(0)=3:fort=1to24:sp%(t)=2:next
- 3030 np(0)=9:np(1)=9:ct=int(rnd(1)*2):poke2040,sb:pokev+21,31
- 3039 rem* sprites for thin red strips
- 3040 fort=0to3:pokev+40+t,2:poke2041+t,sb+t+6:next
- 3050 pokev+2,79:pokev+3,105:pokev+4,135:pokev+5,105:pokev+6,135:pokev+7,161
- 3060 pokev+8,79:pokev+9,161
- 3080 print""left$(d$,24)"[155] to quit press (q) during your move ";
- 3090 qf=0:gosub9050:return
- 3999 rem*** human-where place a piece?
- 4000 w1=3:gosub9400:rem* dsply select
- 4010 gosub9500:rem* pick space routine
- 4020 ifsp%(sn%(cx,cy))=2thenreturn
- 4030 gosub9300:w1=4:gosub9400:gosub8000:rem* space not empty!
- 4040 goto4000
- 4199 rem* human select move
- 4200 w1=3:gosub9400:rem* dsply select
- 4210 gosub9500:rem* pick space routine
- 4220 if sp%(sn%(cx,cy))=ct then4300
- 4230 gosub8000:gosub9300:w1=9:gosub9400:rem* dsply invalid select
- 4240 goto4200
- 4299 rem* move where?
- 4300 gosub8250:gosub9300:w1=10:gosub9400:w1=3:gosub9400:rem*dsply move where?
- 4310 gosub 8900:k=4:rem* make map
- 4320 cx=ma(k,0):cy=ma(k,1):gosub9350
- 4330 gosub9100:ifcr=1thencx=ma(4,0):cy=ma(4,1):return
- 4340 ifk=4thenk=j:goto4360
- 4350 if (j<>4) and (k<>j) then k=4
- 4360 ifma(k,0)=-1thenk=4
- 4370 goto4320
- 4499 rem* human pick piece for capture
- 4500 gosub 9500
- 4510 ifsp%(sn%(cx,cy))<>ltthen gosub8000:goto 4500:rem* invalid selection
- 4520 gosub9800:rem* piece in mill?
- 4530 iff1=0thenreturn:rem* no
- 4540 gosub9900:rem*yes, are others not?
- 4550 iff2>0thenreturn:rem* f2>0=no.
- 4560 w1=7:gosub8050:gosub9300:w1=7:gosub 9400:rem* yes,piece protected in mill.
- 4570 goto4500:rem* select again.
- 4999 rem* computer place a piece
- 5000 m%=0:w1=12:gosub9400
- 5010 cx=3:cy=3:gosub9350
- 5019 rem* pass 1
- 5020 fort=1to24
- 5030 if sp%(t)<>2then cl%(t)=0:goto5060
- 5040 gosub5200:cl%(t)=ps%(w4)
- 5050 if cl%(t)=7 then m%=m%+1
- 5060 next
- 5099 rem* pass 2
- 5100 hs=0
- 5110 fort=1to24:sc=0:cx=xy%(t,0):cy=xy%(t,1):gosub9350
- 5120 on cl%(t) gosub 5500,5550,5600,5650,5700,5750,5800,5850,5900
- 5140 sc=pf%(sc,cs)+int(rnd(1)*10)
- 5150 if sc>hs then hs=sc:bs=t
- 5160 next
- 5170 sp=bs:cx=xy%(bs,0):cy=xy%(bs,1):gosub9350
- 5180 return
- 5199 rem* determine space type
- 5200 w1=sp%(as%(t,0)):w2=sp%(as%(t,1))
- 5210 gosub5300:w4=w3
- 5220 w1=sp%(as%(t,2)):w2=sp%(as%(t,3))
- 5230 gosub5300:w4=w4+w3*6
- 5240 return
- 5299 rem* calc placement situation
- 5300 if w1=2 then5400
- 5310 if w1=ct then 5350
- 5320 if w2=2 then w3=2:return
- 5330 if w2=ct then w3=4:return
- 5340 w3=5:return
- 5350 if w2=2 then w3=1:return
- 5360 if w2=ct then w3=3:return
- 5370 w3=4:return
- 5400 if w2=2 then w3=0:return
- 5410 if w2=ct then w3=1:return
- 5420 w3=2:return
- 5499 rem** determine scoring by class
- 5500 sc=1:return
- 5550 ifm%>1thensc=4:return
- 5560 gosub 5950
- 5570 if(w1=0)and(w2=0)then sc=13:return
- 5575 if(w1=0)and(w2>0)then sc=12:return
- 5580 if(w1>0)and(w2=0)then sc=11:return
- 5585 sc=10:return
- 5600 sc=18:return
- 5650 sc=3:return
- 5700 sc=2:return
- 5750 sc=14:return
- 5800 sc=5:return
- 5850 w1=0:fork=0to3:if sp%(as%(t,k))=2thenw1=w1+1
- 5860 next:if w1=0then sc=17:return
- 5875 if w1=1 then sc=16:return
- 5880 sc=15:return
- 5900 gosub5950
- 5910 if(w1=0)and(w2=0)then sc=9:return
- 5920 if(w1=0)and(w2>0)then sc=8:return
- 5930 if(w1>0)and(w2=0)then sc=7:return
- 5940 sc=6:return
- 5949 rem* count n3 and n6's
- 5950 w1=0:w2=0:fork=0to3
- 5960 ifcl%(as%(t,k))=3thenw1=w1+1
- 5970 ifcl%(as%(t,k))=6thenw2=w2+1
- 5980 next:return
- 5999 rem* comp select move
- 6000 w1=12:gosub9400
- 6010 gosub 6800:f3=f3+7296:hs=0:bs=0:bd=4
- 6020 rf%=6-cs*3:for z=1to24:ifsp%(z)<>ct then6190
- 6030 cx=xy%(z,0):cy=xy%(z,1):gosub9350:gosub8900:if f1=0 then 6190
- 6040 gosub 6700:ss=peek(f3+w1+ts%(z)*256)
- 6050 sp%(z)=2:fork=0to3:if ma(k,0)=-1 then 6180
- 6060 w4=sn%(ma(k,0),ma(k,1)):gosub6600
- 6065 sc=mr%(ss,peek(8832+w1+ts%(z)*256))+int(rnd(1)*rf%)
- 6070 if sc>hs then hs=sc:bs=z:bd=k
- 6180 next:sp%(z)=ct
- 6190 next
- 6200 if bd<>4 then cx=xy%(bs,0):cy=xy%(bs,1)
- 6210 k=bd:return
- 6599 rem* calc move factor index
- 6600 w1=0:fori=0to3
- 6610 w2=as%(w4,i):w3=sp%(w2)
- 6620 if w3=2 then 6670
- 6630 if w3=ct then w3=0:goto6670
- 6650 w3=1:if(sp%(as%(w2,0))=lt)and(sp%(as%(w2,1))=lt)then w3=3:goto6670
- 6660 if(sp%(as%(w2,2))=lt)and(sp%(as%(w2,3))=lt)then w3=3
- 6670 w1=w1+w3*(4^i):next:return
- 6699 rem* calc stay factor index
- 6700 w1=0:fork=0to3
- 6710 w2=as%(z,k):w3=sp%(w2)
- 6720 if w3=2 then 6770
- 6730 if w3=ct then w3=0:goto6770
- 6750 w3=1:if(sp%(as%(w2,0))=lt)and(sp%(as%(w2,1))=lt)then w3=3:goto6770
- 6760 if(sp%(as%(w2,2))=lt)and(sp%(as%(w2,3))=lt)then w3=3
- 6770 w1=w1+w3*(4^k):next:return
- 6799 rem* can enemy form a mill?
- 6800 f3=0:forz=1to24
- 6810 if sp%(z)=lt then gosub 6900
- 6820 next:return
- 6899 rem* mill sub-scan routine
- 6900 cx=xy%(z,0):cy=xy%(z,1):gosub8900:if f1=0 thenreturn
- 6905 sp%(z)=2
- 6910 forj=0to3:if ma(j,0)=-1then6970
- 6920 cx=ma(j,0):cy=ma(j,1):gosub9350
- 6930 w1=sn%(cx,cy)
- 6940 if(sp%(as%(w1,0))=lt)and(sp%(as%(w1,1))=lt)then f3 = 768
- 6950 if(sp%(as%(w1,2))=lt)and(sp%(as%(w1,3))=lt)then f3 = 768
- 6970 next:sp%(z)=lt:return
- 6999 rem* comp select capture
- 7000 w1=12:gosub9400
- 7010 hs=0:bs=0
- 7020 fort=1to24
- 7030 if sp%(t)<>lt then goto7080
- 7040 cx=xy%(t,0):cy=xy%(t,1):gosub9350
- 7050 gosub5200:sc=cf%(w4)
- 7060 w1=4-cs(ct):sc=cf%(w4)+int(rnd(1)*(w1*4))
- 7070 if sc>hs then hs=sc:bs=t
- 7080 next
- 7090 cx=xy%(bs,0):cy=xy%(bs,1):gosub9350
- 7100 return
- 7998 rem*** sfx
- 7999 rem* buzzer
- 8000 pokes+1,9:pokes+5,0:pokes+6,240:pokes+4,33
- 8010 fort=1to300:next:pokes+4,32:return
- 8049 rem* double buzz
- 8050 pokes+1,8:pokes+5,0:pokes+6,240
- 8060 fork=1to2:pokes+4,33:fort=1to125:next:pokes+4,32:fort=1to25:next:next
- 8070 return
- 8099 rem* appear sound
- 8100 pokes+1,25:pokes+5,0:pokes+6,250:pokes+15,25:pokes+14,128
- 8110 pokes+4,21:pokes+4,20:return
- 8149 rem* disappear sound
- 8150 pokes+1,5:pokes+5,0:pokes+6,250:pokes+15,5:pokes+14,80
- 8160 pokes+4,21:pokes+4,20:return
- 8199 rem* move sound
- 8200 pokes+1,1:pokes+5,32:pokes+6,250
- 8210 pokes+4,17:pokes+4,16:return
- 8249 rem* select sound
- 8250 pokes+1,30:pokes+5,16:pokes+6,240
- 8260 pokes+4,17:fort=1to50:next:pokes+4,16:return
- 8299 rem* mill sound
- 8300 pokes+8,40:pokes+12,0:pokes+13,250:pokes+1,20
- 8310 pokes+11,21:pokes+11,20:return
- 8499 rem* draw win screen base
- 8500 w1$="[160] [161][157][157][157][157][157][160] [165] [163][157][157][157][157][157][157][160] [165][167][164] [161][157][157][157][157][157][157][157][162] [167] [166] [163][157][157][157][157][157][162] [163]"
- 8510 w2$="[160] [161][157][157][157][162] [164] [161][157][157][157][157][157][157][160] [165][166][164] [161][157][157][157][157][157][157][157][162] [167] [166] [163][157][157][157][157][157][162] [163]"
- 8520 print"[147]";:fort=1to50:poke1024+int(rnd(1)*40)+int(rnd(1)*19)*40,28:next
- 8530 print"[152]"w1$:print""left$(l$,32)w2$""
- 8540 printleft$(l$,9)w2$"[145][145][145][145]"w1$
- 8550 print""w1$left$(l$,26)"[145][145][145][145]"w2$"":printleft$(l$,9)w2$"[145][145][145][145]"w1$
- 8560 print" "
- 8570 print" [145][145][145]"
- 8580 print"[168][168][168][168][150][169][170][145][157][157][171][172][168][168][168][168][149][173][174][173][174][173][168][168][168][168][150][169][170][145][157][157][171][172][168][168][168][168][149][173][174][173][174][173][168][168][168][168][150][169][170][145][157][157][171][172][168][168][168]"
- 8590 fort=0to4:poke2040+t,sb:next:print""left$(l$,19)left$(d$,8);:return
- 8699 rem* scan for entrapment (patch)
- 8700 f2=0:z=1
- 8710 if sp%(z)<>ct then8760
- 8720 cx=xy%(z,0):cy=xy%(z,1):w1=mf%(cx,cy):w2=mf%(cy,cx)
- 8730 forj=0to3:w3=(cx+w1*jx(j))and7:w4=(cy+w2*jy(j))and7
- 8740 ifsp%(sn%(w3,w4))=2 thenf2=1
- 8750 next:if f2=1 then400:rem*end patch
- 8760 z=z+1:if z<25then8710
- 8770 gosub8050:w1=13:gosub9400:gosub9200:qf=1:on(ct+1)goto 700,800:rem* trapped
- 8899 rem* potential move assessment
- 8900 ma(4,0)=cx:ma(4,1)=cy:f1=0
- 8910 fort=0to3:w1=(mf%(cx,cy)*jx(t)+cx)and7:w2=(mf%(cy,cx)*jy(t)+cy)and7
- 8920 ifsp%(sn%(w1,w2))<>2thenma(t,0)=-1:goto8940
- 8930 ma(t,0)=w1:ma(t,1)=w2:f1=1
- 8940 next:return
- 8999 rem* blank screen
- 9000 poke53265,peek(53265)and239:return
- 9049 rem* unblank screen
- 9050 poke53265,peek(53265)or16:return
- 9099 rem*** human input
- 9100 j=peek(56320)and31:if(j<31)thencr=sgn(jand16):cr=(cr+1)and1:j=jv(j):return
- 9110 j=4:cr=0:getm$
- 9120 ifm$=chr$(13)thencr=1:return
- 9130 ifm$="[145]"thenj=0
- 9140 ifm$=""thenj=1
- 9150 ifm$=""thenj=2
- 9160 ifm$="[157]"thenj=3
- 9180 if(m$="q")and(qf=0)thenprint"game will quit at end of turn.":qf=1:gosub8100
- 9190 return
- 9199 rem* wait for fire/return
- 9200 gosub9100:ifcr=1then9200
- 9210 gosub9100:ifcr=0then9210
- 9220 return
- 9299 rem* clear window
- 9300 print""left$(d$,8):fort=0to12:printleft$(l$,26)mc$(ct)" ":next
- 9310 print""left$(d$,8)
- 9320 w1=ct:gosub9400:return
- 9349 rem* update cursor
- 9350 poke2040,sb:pokev,38+cx*24:pokev+1,64+cy*24:poke2040,sb+5:return
- 9399 rem* display message
- 9400 printleft$(l$,26)mc$(ct)ms$(w1):return
- 9499 rem* human pick a space on board
- 9500 cx=3:cy=3:gosub9350:rem*set cursor
- 9510 gosub9100:ifcr=1thenreturn
- 9520 ifj=4then9510:rem* no movement
- 9530 w1=(mf%(cx,cy)*jx(j)+cx)and7:w2=(mf%(cy,cx)*jy(j)+cy)and7
- 9540 ifgb%(w1,w2)=3then9510:rem* wall!
- 9550 cx=w1:cy=w2:gosub9350
- 9560 fort=1to75:next:goto9510
- 9599 rem* animate appearance
- 9600 fort=0to4:poke2040,sb+t:fork=1to40:next:next
- 9610 gosub9650:rem* space fill
- 9620 poke2040,sb+5:return
- 9649 rem* draw piece on screen
- 9650 print""left$(l$,cx*3)left$(d$,cy*3)c$(ct)pp$(sp%(sn%(cx,cy))):return
- 9699 rem* on board piece count
- 9700 w1=0:w2=0
- 9710 fort=1to24:ifsp%(t)=0thenw1=w1+1
- 9720 ifsp%(t)=1thenw2=w2+1
- 9730 next:return
- 9799 rem* check for mill defense local
- 9800 w1=sn%(cx,cy):w2=0:f1=0
- 9810 if(sp%(as%(w1,0))=lt)and(sp%(as%(w1,1))=lt)thenf1=1
- 9820 if(sp%(as%(w1,2))=lt)and(sp%(as%(w1,3))=lt)thenf1=1
- 9830 return
- 9899 rem* check for mill defense global
- 9900 w1=6:gosub9400:f2=1
- 9910 fort=1to24:ifsp%(t)<>ltthen9940
- 9920 f1=0:if(sp%(as%(t,0))=lt)and(sp%(as%(t,1))=lt)thenf1=1
- 9930 if(sp%(as%(t,2))=lt)and(sp%(as%(t,3))=lt)thenf1=1
- 9935 f2=f2*f1
- 9940 next:return
- 9949 rem* animate capture
- 9950 poke2040,sb+4:gosub9650
- 9960 fort=3to0step-1:poke2040,sb+t:fork=0to40:next:next
- 9970 poke2040,sb+5:return
- 9999 rem* game board layout data-gb%(,)
- 10000 data 2,3,3,2,3,3,2,3
- 10010 data 3,2,3,2,3,2,3,3
- 10020 data 3,3,2,2,2,3,3,3
- 10030 data 2,2,2,3,2,2,2,3
- 10040 data 3,3,2,2,2,3,3,3
- 10050 data 3,2,3,2,3,2,3,3
- 10060 data 2,3,3,2,3,3,2,3
- 10070 data 3,3,3,3,3,3,3,3
- 10099 rem* xy movement distances-mf%(,)
- 10100 data 3,0,0,3,0,0,3
- 10110 data 0,2,0,2,0,2,0
- 10120 data 0,0,1,1,1,0,0
- 10130 data 1,1,1,1,1,1,1
- 10140 data 0,0,1,1,1,0,0
- 10150 data 0,2,0,2,0,2,0
- 10160 data 3,0,0,3,0,0,3
- 10199 rem* space converter table-sn%()
- 10200 data 23,0,0,5,0,0,20
- 10210 data 0,19,0,1,0,16,0
- 10220 data 0,0,15,12,24,0,0
- 10230 data 11,4,8,0,6,2,9
- 10240 data 0,0,22,10,17,0,0
- 10250 data 0,14,0,3,0,21,0
- 10260 data 18,0,0,7,0,0,13
- 10599 rem* message $
- 10600 data " #$ sun %& player:"
- 10610 data " ;< moon => player:"
- 10620 data "you have pieces left to place."
- 10630 data "use joy2 or crsr keys toselect."
- 10640 data "you must choose an empty space!"
- 10650 data"a mill has been formed.now select an opposing piece for capture!"
- 10660 data "------------please wait.------------"
- 10670 data "you may not capture a piece in a mill, while others are not."
- 10680 data "it is your turn to movea piece."
- 10690 data "you need to select a piece to move!"
- 10700 data "move piece to where?"
- 10710 data"your move iscanceled! press fire or return to continue."
- 10720 data "????????????? thinking ?????????????"
- 10730 data"you can not move any of your pieces! press fire or return."
- 10999 rem* adj space table-as%(,)
- 11000 data 5,12,19,16,16,21,6,9
- 11010 data 10,7,14,21,19,14,11,8
- 11020 data 23,20,1,12,24,17,2,9
- 11030 data 13,18,3,10,22,15,4,11
- 11040 data 20,13,2,6,17,22,3,7
- 11050 data 18,23,4,8,15,24,1,5
- 11060 data 9,20,7,18,3,21,4,19
- 11070 data 8,22,12,24,1,19,2,21
- 11080 data 6,24,10,22,7,13,11,23
- 11090 data 4,14,1,16,5,23,9,13
- 11100 data 2,16,3,14,10,17,8,15
- 11110 data 11,18,5,20,12,15,6,17
- 11199 rem* placement factors-pf%(,)
- 11200 data -100,-100,53,120
- 11210 data 49,105,46,95
- 11230 data 43,85,40,75
- 11250 data 37,65,34,60
- 11270 data 31,55,28,47
- 11290 data 25,40,22,35
- 11310 data 19,30,16,25
- 11330 data 13,20,10,15
- 11350 data 7,10,4,5
- 11370 data 1,1
- 11399 rem* placement situations-ps%()
- 11400 data 9,3,6,1,8,5
- 11410 data 3,4,2,1,2,5
- 11420 data 6,2,7,1,8,5
- 11430 data 1,1,1,1,1,1
- 11440 data 8,2,8,1,8,5
- 11450 data 5,5,5,1,5,5
- 11499 rem* capture factors-cf%()
- 11500 data 85,100,135,115,95,15
- 11510 data 100,110,145,125,101,25
- 11520 data 135,145,155,150,140,10
- 11530 data 115,125,150,130,120,30
- 11540 data 95,105,140,120,90,20
- 11550 data 15,25,10,30,20,5
- 11599 rem* type of space-ts%()
- 11600 data 2,2,2,2,1,1,1,1
- 11610 data 1,1,1,1,0,0,0,0
- 11620 data 0,0,0,0,0,0,0,0
- 11699 rem* movement ranks-mr%(,)
- 11700 data 1,2,3,4,5,6,7,8,9,10,11,12,13,14
- 11710 data 15,31,47,48,49,50,51,52,53,54,55,215,89,200
- 11720 data 16,32,56,68,82,83,84,85,86,87,88,216,98,201
- 11730 data 17,33,57,69,126,127,128,129,130,131,132,219,99,204
- 11740 data 18,34,58,70,112,113,114,115,116,117,118,220,100,205
- 11750 data 19,35,59,71,119,120,121,122,123,124,125,221,101,206
- 11760 data 20,36,60,72,140,141,142,143,144,145,146,222,102,207
- 11770 data 21,37,61,73,133,134,135,136,137,138,139,218,103,203
- 11780 data 22,38,62,74,157,158,159,160,161,154,162,223,104,208
- 11790 data 23,39,63,75,163,164,165,166,167,155,168,224,105,209
- 11800 data 24,40,64,76,147,148,149,150,151,152,153,217,102,202
- 11810 data 25,41,65,77,169,170,171,172,173,156,174,225,107,210
- 11820 data 26,42,66,78,175,176,178,179,180,181,182,226,108,211
- 11830 data 27,43,67,190,191,192,193,194,195,196,198,227,109,212
- 11840 data 28,44,199,229,230,231,232,233,234,235,236,237,227,238
- 11850 data 29,45,79,80,90,91,92,93,94,95,96,97,110,213
- 11860 data 30,46,81,89,183,184,185,186,187,188,189,228,111,214
- 11870 data 248,239,240,241,242,243,244,245,246,249,247,250,251,252
- 40000 fori=0to21:poke828+i,8+i:next:poke788,49
- 40010 ifdv<8ordv>29ordv=8then40030
- 40020 a=peek(828):b=peek(828+dv-8):poke828,b:poke828+dv-8,a
- 40030 a$="hello connect":forj=8to29:i=peek(828+j-8):ifi=14thennext
- 40040 close2:open2,i,2:close2:ifstthen40060
- 40050 close15:open15,i,15,"r0:"+a$+"="+a$:input#15,er:close15:ifer=63then40070
- 40060 next:print"[147]":poke53272,23:poke186,8:end
- 40070 q$=chr$(34):poke646,peek(53281):print"[147]":poke53272,23
- 40080 print"[147]p[207]2048,0:p[207]44,8:p[207]43,1:p[207]56,160:p[207]55,0:clr:l[207]"q$a$q$","i
- 40090 print"run:":poke631,13:poke632,13:poke198,2:end
-