REM le jeu 'Connexion' ou 'Wu Hsing' @Cassiope34 0118 FN.DEF clr( c$ ) % format: alpha R V B mode gr.color val(word$(c$,1)), val(word$(c$,2)), val(word$(c$,3)), val(word$(c$,4)), val(word$(c$,5)) FN.END Fn.def LastPtr(ptr) % put the graphic pointer 'ptr' UP to all other. gr.getDL ndl[],1 : array.length sz, ndl[] if !ptr | sz=1 | ndl[sz] =ptr then array.delete ndl[] : Fn.rtn 0 array.search ndl[],ptr,nptr if nptr for nn=nptr to sz-1 : ndl[nn] =ndl[nn+1] : next : ndl[sz] =ptr : gr.newDL ndl[] endif array.delete ndl[] Fn.end Fn.def move(ptr, arx, ary, speed) % move smoothly the bitmap 'ptr' to arx,ary LastPtr( ptr ) if speed>1 do gr.get.position ptr,dpx,dpy ix =int((dpx-arx)/speed) : iy =int((dpy-ary)/speed) if abs(ix)<3 & abs(iy)<3 then D_u.break gr.modify ptr, "x",dpx-ix, "y",dpy-iy : gr.render until 0 endif gr.modify ptr, "x",arx, "y",ary : gr.render Fn.end FN.DEF RectR(x,y, c, lx,ly, fill) % make rectangle with rounded corners. GR.ARC nul, x, y, x+c, y+c, -90, -90, fill % top left GR.ARC nul, x+lx-c,y, x+lx, y+c, -90, 90, fill % top right GR.ARC nul, x, y+ly-c,x+c, y+ly, -180, -90, fill % bottom left GR.ARC nul, x+lx-c, y+ly-c, x+lx, y+ly, 0, 90, fill % bottom right if !fill GR.LINE r1, x+c/2, y, x+lx-c/2, y % left GR.LINE r2, x, y+c/2, x, y+ly-c/2 % up GR.LINE r3, x+c/2, y+ly, x+lx-c/2, y+ly % right GR.LINE r4, x+lx, y+c/2, x+lx, y+ly-c/2 % down else c*=0.4 gr.rect nul, x+c, y, x+lx-c, y+ly gr.rect nul, x, y+c, x+lx, y+ly-c endif FN.END gr.open 255,80,130,80,0,0 % landscape gr.screen w,h : scx =1280 : scy =800 : sx =w/scx : sy =h/scy : gr.scale sx, sy File.Root tmp$ IsApk =!Is_In("rfo-basic",tmp$) % to know if it's an APK for the way to exit path$ ="" %"Connexion/" filename$ ="WuHsing.sav" Device b Bundle.get b, "Language", lang$ if left$(lower$(lang$),2)="fr" then lang =2 else lang =1 % French or English GOSUB InitBmp DIM g[18,14], p[18,14], v[18,14], dj$[2], sco[2], tt[2], vv[5], pass[2] % la grille. ARRAY.LOAD diX[], 0, 1, 0,-1, 1, 1,-1,-1 % 1 =North, 2 =East, 3 =South, 4 =West ARRAY.LOAD diY[],-1, 0, 1, 0,-1, 1, 1,-1 % 5 =NE, 6 = SE, 7 =SW, 8 =NW. start =int(rnd()*2)+1 DO GOSUB InitGame Do if !help GOSUB ctrlFIN if fin then popup " "+word$("I.A. win...-You win...-Ex aequo",fin,"-")+" ",-200,-600 endif do gr.touch touched, x, y if !background() then gr.render pause 10 until touched | new | quit | help if new | quit then D_U.break x/=sx : y/=sy : gr.modify curs, "x",x, "y",y : mv =0 if help LastPtr(bhelp) : gr.show bhelp : gr.bitmap.size b1help, width, height if height>800 gr.get.position bhelp,ox,oy : dtY =y-oy do gr.touch touched, hx, hy : hx/=sx : hy/=sy : nhy =hy-dtY : nhy =MIN(nhy,0) : nhy =MAX(nhy,-480) gr.modify bhelp, "y", nhy : gr.render % si francais alors bouge l'aide en y until !touched | new | quit | !help endif d_u.continue endif for n=1 to 15 if GR_COLLISION( curs, dm[n] ) then f_n.break % quel domino est touché next if n<16 & !fin d =IS_IN(USING$(,"%02.0f ",n),dj$[j]) % un domino du camp de j. if n=cdo | (d & !cdo) mv =1 : gr.get.position dm[n],ox,oy : deltaX =x-ox : deltaY =y-oy : LastPtr(dm[n]) : cdo =n if ox>18*57 then se =1 : ori =(se=1 | se=3)+2*(se=2 | se=4) % 1=vertical 2=horizontal gr.modify rond, "x", ox+(57/2)*ori, "y", oy+(57/ori) : gr.show rond endif endif gx =int((x-2)/57)+1 : gy =int((y-2)/57)+1 if gx>21 & gy=1 & !fin GOSUB AI : cdo =0 : se =1: j =3-j : GOSUB AI : cdo =0 : se =1: j =3-j : d_u.continue % temporaire... endif do gr.touch touched, tx, ty : tx/=sx : ty/=sy if mv % déplace le domino et le rond. gr.modify dm[n], "x", tx-deltaX, "y", ty-deltaY gr.modify rond, "x", tx-deltaX+(57/2)*ori, "y", ty-deltaY+(57/ori) : gr.render endif until !touched cx =int((tx+20-deltaX-2)/57)+1 : cy =int((ty+20-deltaY-2)/57)+1 % endroit du laché ok =0 : di =HYPOT(tx-x,ty-y) % distance en pixels entre le 'posé' et le 'laché'... if mv if cx<19 % on pose bien sur le plateau. if di<20 % rotation de la pièce. ok =1 : se+=1-4*(se=4) : LastPtr(rond) : ori =(se=1|se=3)+2*(se=2|se=4) % 1=vertical 2=horizontal gr.modify rond, "x", ox+(57/2)*ori, "y", oy+(57/ori) : LastPtr(dm[n]) gr.modify dm[n] , "x",ox, "y",oy ,"bitmap", dom[n-15*(n>15),se] % replace correctement sur la grille else % simple déplacement de la pièce et place correctement sur la grille. LastPtr(rond) : gr.modify rond, "x", 2+(cx-1)*57+(57/2)*ori, "y", 1+(cy-1)*57+(57/ori) move(dm[n], 2+(cx-1)*57, 1+(cy-1)*57, 2) : ok =1 : pcx =cx : pcy =cy endif endif if !ok % retour au camp manuel... mais rangement auto. if cdo<16 y =int(cdo/3.1)+1 : x =cdo-(y-1)*3 : move(dm[cdo], (14+x)*71, 50+(y-1)*130, 2) gr.modify dm[cdo], "bitmap", dom[cdo,1] : cdo =0 : gr.hide rond endif endif elseif cx>18 & cy>11 & cdo & !fin % bouton 'ok' + maj grille g[] dj =cdo-15*(cdo>15) : cl1 =val(left$(word$(rf$,dj),1)) : cl2 =val(right$(word$(rf$,dj),1)) if se=2 | se=3 then swap cl1,cl2 ori =(se=1 | se=3)+2*(se=2 | se=4) : h =(ori=2) : v =(ori=1) : cx =pcx : cy =pcy : GOSUB ctrlOK if ok g[cx,cy] =cl1 : g[cx+h,cy+v] =cl2 : p[cx,cy] =ori % indication du sens 1=vertical 2=horizontal GOSUB MajVoisin tt[j]+=ntc : gr.modify sco[j], "text", word$("I.A. You",j)+" : "+USING$(,"%04.0f",tt[j]) : LastPtr(sco[j]) dj$[j] =replace$(dj$[j],USING$(,"%02.0f ",cdo),"") : cdo =0 : se =1 : j =3-j : gr.hide rond pass[j] =0 : if len(dj$[j])=0 then pass[j] =1 dx =min(max(1,cx-1),dx) : dy =min(max(1,cy-1),dy) % bornage... ax =max(min(18,cx+h+1),ax) : ay =max(min(14,cy+v+1),ay) GOSUB AI : cdo =0 : se =1 : j =3-j % le coup de l'AI. else popup " Invalid position... ",-200,-600 endif elseif cx>18 & cy>11 & !cdo & !fin % bouton 'ok' sans domino posé avant pour 'passer' ou savoir si je peux jouer. verif =1 : GOSUB AI : verif =0 if len(pos$) popup " you can play... ",-200,-600 : se =1 : cdo =0 : ori =1 else se =1: j =3-j : GOSUB AI : cdo =0 : se =1: j =3-j endif endif Until new UNTIL quit if !fin then GOSUB SaveGame if IsApk then EXIT END "Bye...!" OnBackKey: if help : help =0 : gr.hide bhelp else : GOSUB BoiteMenu endif Back.Resume BoiteMenu: Dialog.message win$," What do we do ?", mok, " Exit ", " New game ", " Help " new =(mok=2) : quit =(mok=1) : help =(mok=3) return SaveGame: cls ?int$(tt[1])+" "+int$(tt[2])+" "+cp$ console.save path$+filename$ cls return MajVoisin: for d=1 to 4 % voisinage nx =cx+diX[d] : ny =cy+diY[d] if nx & nx<19 & ny & ny<15 if !g[nx,ny] then v[nx,ny]++ endif next for d=1 to 4 % voisinage nx =cx+h+diX[d] : ny =cy+v+diY[d] if nx>0 & nx<19 & ny>0 & ny<15 if !g[nx,ny] then v[nx,ny]++ endif next cp$ =cp$ + int$(j)+USING$(,"%02.0f",cdo)+int$(se)+USING$(,"%02.0f",cx)+USING$(,"%02.0f ",cy) % enregistre le coups... return ctrlFIN: if pass[1]+pass[2]=2 & !fin for jo =1 to 2 ndj =len(dj$[jo]) if ndj : ndj/=3 for dr=1 to ndj if IS_IN(word$(dj$[jo],dr),"11 22 33 44 55") then tt[jo]-=5 else tt[jo]-=25 gr.modify sco[jo], "text", word$("AI Moi",jo)+" : "+USING$(,"%04.0f",tt[jo]) : LastPtr(sco[jo]) : gr.render next endif next if tt[1]>tt[2] : fin =1 % AI gagne elseif tt[1]15) : cl1 =val(left$(word$(rf$,dj),1)) : cl2 =val(right$(word$(rf$,dj),1)) if se=2 | se=3 then swap cl1,cl2 for cy=dy to ay : for cx=dx to ax nx =cx+h : ny =cy+v if nx<19 & ny<15 if v[cx,cy]+v[cx+h,cy+v]>1 % voisinage ok GOSUB ctrlOK if ok then pos$+=USING$(,"%02.0f",cdo)+int$(se)+USING$(,"%02.0f",cx)+USING$(,"%02.0f",cy)+USING$(,"%03.0f ",ntc) endif endif next : next next next gr.modify mess3, "text", "" : gr.render if len(pos$) % coup choisi au hasard dans pos$ si non vide... (ou bien le meilleur gain ! ) if !verif ncp =len(pos$)/11 : ch$ =word$(pos$,int(rnd()*ncp)+1) : best =0 for m=1 to ncp % ou bien chercher les coups qui rapporte le + !!! ch$ =word$(pos$,m) : rap =val(mid$(ch$,8,3)) if rap>best : res$ =ch$+" " : best =rap elseif rap =best : res$+=ch$+" " endif next ncp =len(res$)/11 : ch$ =word$(res$,int(rnd()*ncp)+1) cdo =val(left$(ch$,2)) : se =val(mid$(ch$,3,1)) : cx =val(mid$(ch$,4,2)) : cy =val(mid$(ch$,6,2)) dj =cdo-15*(cdo>15) : cl1 =val(left$(word$(rf$,dj),1)) : cl2 =val(right$(word$(rf$,dj),1)) if se=2 | se=3 then swap cl1,cl2 ori =(se=1 | se=3)+2*(se=2 | se=4) : h =(ori=2) : v =(ori=1) : g[cx,cy] =cl1 : g[cx+h,cy+v] =cl2 : p[cx,cy] =ori GOSUB MajVoisin gr.modify dm[cdo] ,"bitmap", dom[cdo-15*(cdo>15),se] : move(dm[cdo], 2+(cx-1)*57, 1+(cy-1)*57, 4) dj$[j] =replace$(dj$[j],USING$(,"%02.0f ",cdo),"") tt[j]+=val(mid$(ch$,8,3)) : gr.modify sco[j], "text", word$("I.A. You",j)+" : "+USING$(,"%04.0f",tt[j]) LastPtr(sco[j]) dx =min(max(1,cx-1),dx) : dy =min(max(1,cy-1),dy) % nouveaux bornages... ax =max(min(18,cx+h+1),ax) : ay =max(min(14,cy+v+1),ay) pass[j] =0 : if len(dj$[j])=0 then pass[j] =1 endif ! popup " en "+int$(clock()-t)+" ms. " else popup " "+word$("I.A. You",j)+" pass... ",-200,-600 : pass[j] =1 endif RETURN ctrlOK: % voir si le domino 'cdo' peut être posé en cx,cy ds le sens 'se'. ok =1 if cx+h>18 | cy+v>14 then ok =0 : return % la 2ème case est hors plateau. if g[cx,cy] | g[cx+h,cy+v] then ok =0 : return % une case de posé du domino non vide. if ori=1 then di =4 else di =1 % tests pour l'interdiction de 4 dominos côte à côte... c =1 : nx =cx : ny =cy for d=1 to 3 nx+=diX[di] : ny+=diY[di] if nx>0 & nx<19 & ny>0 & ny<15 if p[nx,ny]=ori then c++ else f_n.break else f_n.break endif next if c<3 nx =cx : ny =cy : di =2*(di=4)+3*(di=1) % voir ds la direction opposée. for d=1 to 3 nx+=diX[di] : ny+=diY[di] if nx>0 & nx<19 & ny>0 & ny<15 if p[nx,ny]=ori then c++ else f_n.break else f_n.break endif next endif if c>3 then ok =0 : return ! si ok=1 alors il faut fabriquer 3 chaines suivant le sens du domino et les tester... ! dès qu'une seule chaine n'est pas bonne : on sort avec ok=0... if ori =1 then di =4 else di =1 % 1ère chaine testée = perpendiculaire à la 1ère case du domino. nx =cx : ny =cy : nc =1 : ct$ =int$(cl1) % la couleur de la 1ère case du domino. for c=1 to 16 nx+=diX[di] : ny+=diY[di] if nx & nx<19 & ny & ny<15 if g[nx,ny] : nc++ if len(ct$)<6 then ct$=int$(g[nx,ny])+ct$ else : f_n.break endif else : f_n.break endif next nx =cx : ny =cy : di =2*(di=4)+3*(di=1) % puis ds la direction opposée. for c=1 to 16 nx+=diX[di] : ny+=diY[di] if nx & nx<19 & ny & ny<15 if g[nx,ny] : nc++ if len(ct$)<12 then ct$+=int$(g[nx,ny]) else : f_n.break endif else : f_n.break endif next GOSUB ChaineOK if !ok then return ntc =nc : nc =0 if ori =1 then di =4 else di =1 % 2ème chaine testée = perpendiculaire à la 2ème case du domino. nx =cx+h : ny =cy+v : nc =1 : ct$ =int$(cl2) % la couleur de la 2ème case du domino. for c=1 to 16 nx+=diX[di] : ny+=diY[di] if nx & nx<19 & ny & ny<15 if g[nx,ny] : nc++ if len(ct$)<6 then ct$=int$(g[nx,ny])+ct$ else : f_n.break endif else : f_n.break endif next nx =cx+h : ny =cy+v : di =2*(di=4)+3*(di=1) % puis ds la direction opposée. for c=1 to 16 nx+=diX[di] : ny+=diY[di] if nx & nx<19 & ny & ny<15 if g[nx,ny] : nc++ if len(ct$)<12 then ct$+=int$(g[nx,ny]) else : f_n.break endif else : f_n.break endif next GOSUB ChaineOK if !ok then return ntc*=nc if ori =1 then di =1 else di =4 % 3ème chaine testée = dans le sens du domino. nx =cx : ny =cy : nc =2 : ct$ =int$(cl1)+int$(cl2) for c=1 to 16 nx+=diX[di] : ny+=diY[di] if nx & nx<19 & ny & ny<15 if g[nx,ny] : nc++ if len(ct$)<7 then ct$=int$(g[nx,ny])+ct$ else : f_n.break endif else : f_n.break endif next nx =cx+h : ny =cy+v : di =2*(di=4)+3*(di=1) % puis ds la direction opposée derrière la 2ème case du domino... for c=1 to 16 nx+=diX[di] : ny+=diY[di] if nx & nx<19 & ny & ny<15 if g[nx,ny] : nc++ if len(ct$)<12 then ct$+=int$(g[nx,ny]) else : f_n.break endif else : f_n.break endif next GOSUB ChaineOK if !ok then return ntc*=nc if IS_IN(word$(rf$,cdo-15*(cdo>15)),"11 22 33 44 55") then ntc*=2 % on double les points du coup si domino double... RETURN ChaineOK: % teste si un alignement de couleur(s) (une chaine de caractère 'ct$' ) est autorisé... array.fill vv[],0 : lc =len(ct$) : lg =0 for c=1 to lc a =val(mid$(ct$,c,1)) : if vv[a]=0 then vv[a]++ : lg++ else f_n.break next cc$ =mid$(ct$,1,lg) : do : cc$+=cc$ : until len(cc$)>=lc : cc$ =mid$(cc$,1,lc) if cc$<>ct$ then ok =0 RETURN InitBmp: DIM dom[15,4], dm[30], co[5], dj$[2] if lang=2 gr.bitmap.load bmphelp, path$+"Wu_Hsing_rg_fr.png" : gh =1280 % l'aide en 726x1280 (fr) else gr.bitmap.load bmphelp, path$+"Wu_Hsing_rg_en.png" : gh =800 % ou en 726x800 (en) endif gr.bitmap.create b1help, 726,gh gr.bitmap.drawinto.start b1help gr.color 255,186,225,180,1 : gr.rect nul,0,0,726,gh gr.bitmap.draw nul,bmphelp,0,0 gr.bitmap.drawinto.end bhelp gr.bitmap.load domino, path$+"5Couleurs60.png" : n =0 for c=1 to 5 gr.bitmap.crop nul, domino, 4+(c-1)*69,0,61,60 : gr.bitmap.scale co[c], nul, 49,49 : gr.bitmap.delete nul next gr.bitmap.delete domino : rf$ ="11 12 13 14 15 22 23 24 25 33 34 35 44 45 55" % les couleurs des dominos. ! rouge vert bleu jaune orange ARRAY.LOAD coul$[],"255 255 110 110 1","255 140 255 146 1","255 110 250 255 1","255 228 228 140 1","255 255 160 110 1" for y=1 to 3 : for x=1 to 5 n++ for ori=1 to 4 dmx =57 : dmy =114 : if !mod(ori,2) then swap dmx,dmy gr.bitmap.create dom[n,ori], dmx,dmy gr.bitmap.drawinto.start dom[n,ori] gr.set.stroke 1 : gr.color 255,0,0,0,1 : RectR(0,0, 22, dmx,dmy, 1) gr.color 255,240,240,240,1 : gr.circle nul, dmx/2, dmy/2, 3 cl1 =val(left$(word$(rf$,n),1)) : cl2 =val(right$(word$(rf$,n),1)) : if ori=2 | ori=3 then swap cl1,cl2 gr.bitmap.draw nul, co[cl1], 3, 4 : gr.bitmap.draw nul, co[cl2], 3+57*(dmx=114), 4+57*(dmy=114) ! clr( coul$[cl1] ) : gr.rect nul, 4,4,53,53 : clr( coul$[cl2] ) ! gr.rect nul, 4+57*(dmx=114), 4+57*(dmy=114),53+57*(dmx=114),53+57*(dmy=114) % option carré de couleur. gr.color 255,210,210,210,0 : gr.line nul, 57*(dmx=114), 57*(dmy=114), 57, 57 gr.set.stroke 2 : gr.color 255,230,230,230,0 : RectR(0,0, 22, dmx,dmy, 0) next next : next gr.bitmap.drawinto.end RETURN InitGame: GR.CLS : array.fill g[],0 : array.fill p[],0 : array.fill v[],0 : array.fill tt[],0 : cp$ ="" array.fill pass[],0 : array.fill dj$[],"" gr.color 255,104,190,116,2 : RectR(19*57, scy-95, 78, 160,80, 1) : RectR(18.5*57, 8, 30, 216,30, 1) gr.text.size 26 : gr.text.align 2 : gr.set.stroke 2 : gr.color 255,0,255,210,2 gr.text.draw nul, scx-120, 32, "• WU HSING •" % "• CONNEXION •" gr.text.size 34 : gr.color 255,14,122,0,2 : gr.text.draw nul, scx-118, scy-62, "OK or" gr.text.draw nul, scx-118, scy-30, "pass" : gr.color 155,150,150,150,1 : gr.set.stroke 1 for y=1 to 15 : gr.line nul, 2, 1+(y-1)*57, 2+18*57, 1+(y-1)*57 : next % le plateau de jeu. for x=1 to 19 : gr.line nul, 2+(x-1)*57, 2, 2+(x-1)*57, scy-2 : next : :gr.color 255 : n =0 ! les bitmaps du joueur 2, à droite... for y=1 to 5 : for x=1 to 3 n++ : gr.bitmap.draw dm[n], dom[n,1], (14+x)*71, 50+(y-1)*130 : dj$[2]+=USING$(,"%02.0f ",n) next : next ! les bitmaps de l'AI... for n=16 to 30 : gr.bitmap.draw dm[n], dom[n-15,1], 2+(9)*57, -120 : dj$[1]+=USING$(,"%02.0f ",n) : next gr.point curs,0,0 : gr.modify curs, "alpha",0 : gr.render % curseur pour utiliser gr_collision() gr.color 50,255,255,255,1 : gr.circle rond, 2+(10-0.5)*57, 7*57, 70 : gr.color 255 : gr.hide rond gr.color 180,180,180,180,1 : RectR(0, 10, 10, 170,40, 1) : RectR(15.25*57, scy-48, 10, 170,40, 1) gr.set.stroke 2 : gr.text.align 1 : gr.color 255,56,68,255,1 : gr.text.size 32 gr.text.draw sco[1], 6, 40, "I.A. : "+USING$(,"%04.0f",tt[1]) gr.text.draw sco[2], 15.5*57, scy-16, "You : "+USING$(,"%04.0f",tt[2]) gr.color 255,255,255,255,1 : gr.text.size 24 : gr.text.draw mess3, 30, scy-20, "" new =0 : fin =0 : help =0 : dx =8 : dy =6 : ax =11 : ay =9 % les bornages pour l'AI... File.Exists fe,"WuHsing.sav" if fe GOSUB MiseEnPlace % met en place la partie mémorisée ds le fichier "WuHsing.sav" else pause 500 ! les 2 premiers dominos placés au centre, choisi au hasard. ( pas de double au départ...! ) do : pr =int(rnd()*15)+1 : until !IS_IN(word$(rf$,pr),"11 22 33 44 55") : cdo =pr se =2 : gr.modify dm[cdo] ,"bitmap", dom[pr,se] : cx =9 : cy =8 cl1 =val(left$(word$(rf$,pr),1)) : cl2 =val(right$(word$(rf$,pr),1)) : if se=2 | se=3 then swap cl1,cl2 j =2 : ori =(se=1 | se=3)+2*(se=2 | se=4) : h =(ori=2) : v =(ori=1) : GOSUB MajVoisin move(dm[pr], 2+(cx-1)*57, 1+(cy-1)*57, 3) : dj$[2] =replace$(dj$[2],USING$(,"%02.0f ",pr),"") g[cx,cy] =cl1 : g[cx+h,cy+v] =cl2 : p[cx,cy] =ori do : pr2 =int(rnd()*15)+1 : until !IS_IN(word$(rf$,pr2),"11 22 33 44 55") & pr2<>pr : cdo =pr2+15 se =2 : gr.modify dm[cdo] ,"bitmap", dom[pr2,se] : cx =9 : cy =7 cl1 =val(left$(word$(rf$,pr2),1)) : cl2 =val(right$(word$(rf$,pr2),1)) : if se=2 | se=3 then swap cl1,cl2 j =1 : ori =(se=1 | se=3)+2*(se=2 | se=4) : h =(ori=2) : v =(ori=1) : GOSUB MajVoisin move(dm[cdo], 2+(cx-1)*57, 1+(cy-1)*57, 3) : dj$[1] =replace$(dj$[1],USING$(,"%02.0f ",cdo),"") g[cx,cy] =cl1 : g[cx+h,cy+v] =cl2 : p[cx,cy] =ori cdo =0 : j =3-start : start =j if j=1 then GOSUB AI : se =1 : cdo =0 : j =2 % cas oú l'AI commencerait... endif gr.bitmap.draw bhelp, b1help, 230,0 : gr.hide bhelp return MiseEnPlace: % mise en place de la partie mémorisée... cp$ issue de "WuHsing.sav" GRABFILE ldg$, path$+filename$ : dx =8 : dy =6 : ax =11 : ay =9 : c =2 tt[1] =val(word$(ldg$,1)) : gr.modify sco[1], "text", word$("I.A. You",1)+" : "+USING$(,"%04.0f",tt[1]) tt[2] =val(word$(ldg$,2)) : gr.modify sco[2], "text", word$("I.A. You",2)+" : "+USING$(,"%04.0f",tt[2]) do c++ coup$ =word$(ldg$,c) if len(coup$) j =val(left$(coup$,1)) : cdo =val(mid$(coup$,2,2)) : se =val(mid$(coup$,4,1)) cx =val(mid$(coup$,5,2)) : cy =val(mid$(coup$,7)) dj =cdo-15*(cdo>15) : cl1 =val(left$(word$(rf$,dj),1)) : cl2 =val(right$(word$(rf$,dj),1)) if se=2 | se=3 then swap cl1,cl2 ori =(se=1 | se=3)+2*(se=2 | se=4) : h =(ori=2) : v =(ori=1) : GOSUB MajVoisin g[cx,cy] =cl1 : g[cx+h,cy+v] =cl2 : p[cx,cy] =ori gr.modify dm[cdo] ,"bitmap", dom[cdo-15*(cdo>15),se] : move(dm[cdo], 2+(cx-1)*57, 1+(cy-1)*57, 0) dj$[j] =replace$(dj$[j],USING$(,"%02.0f ",cdo),"") dx =min(max(1,cx-1),dx) : dy =min(max(1,cy-1),dy) % calcul des nouveaux bornages pour l'AI... ax =max(min(18,cx+h+1),ax) : ay =max(min(14,cy+v+1),ay) pass[j] =0 : if len(dj$[j])=0 then pass[j] =1 endif until coup$ ="" j =2 : cdo =0 file.delete fe, "WuHsing.sav" RETURN