..
cette page visait initialement à valider l'algorithme de jeu; suite à un design aléatoire, elle permet:
titre="Awalé"
' notes
' appliquant les règles de http://www.african-concept.com/awale-regle-du-jeu.html
' en cas de partie infinie comment savoir qui gagne, raisonnable serait le premier qui retrouve situation identique, mais difficile à mémorise
' pas claire règle 7: si incapable de nourir adversaire le joueur gagne toutes SES ffffgraines et (of course) la partie
' b ugs
' !
' coller possible seulement 256 coups
' si 3 pierres, infini non détecté
'play="1B3D6E4B2D3B6A1D2C3B4C6D2C3A2B5C3F6A2D1C4A5E3D6E2D1B4A5D6D3E6C3A4B1F4B2C3B4E1D6B2A6C5C2E4A5F3B6F1A1E2D4C5B3F4E5C6A1B2A3F1E2D4C5A6B1F2E3A4D5F1E2D3C6F4E5B6A2F3D4E5D6C1F2E3A4D5B6A1C2B3F5A1E6F4E2D3C4B1A215F2E1D3C2B3A416F4E6F5E1D6B2A1C2B3F5A1E6F4D5C2B6F3A1E2C3D4B6A5F6C1E2D3B4A1F5C6F2B3E4A5C1D6C2F3B4E5D1C6B2F3A4E1D5C6F2E3D4C6F5B1A1E2D3C6B4F6F5A1E2D6C3B4A2F1E5D6F3C4E2D3B5C4A5B6A1F3E4D5C6F2A1B2E3D4A1C5B2A6F1E3D4B5A2C1B6F2A3E4D1C5B2F6F3E4C5B6DA1F2D4E5C3B6F4A1E5D2C3B6F1A4E2D5C3B1A16F2E4D3C1B5A6F1E4D5C2B6F"'
'play="C6D1F4B4E2A2F4C3F6F1A1F4D1F6E6B2D5D1B2F4C1F5F2E3D4A1B1F5D4C5F2B4E5B6B5D3C6F2A5E4C5E6E3D1C6F2E5D6A1C4B3F2E6F1A1E4D2C4B6A5E3D5B6C4A5F1E6B2A3C1F2D4C5E3D4B6A2F5E3D6F4E5C6A1D2B3A1F4E5D2C6B3F4A5E1D2C6F3E4D5B6FA1C2E3F4D5B6A1E2C3B4F5E6A1F2D3C4E5B1A6D1C2B3A4F1E5D6F2C3B4A1E5D2C3B4A2516F5E1D6C2B3F4A6E1F2E5D3C6F4E5D6B1C2F3E4B5D6FA2F3C4E1B2D5A1C3B4A5126F5E1D6F2E4D5C3B4A6F2E1D3C2B5A436F1E4D2C5B3A456F5E1D4C2B5A316F1E2D3C4B5F6A2F3E4D5C1B2A316F3E2D3C4B1A6F2E1D3C2B5A146F3E1D2C4B5A6E3F4E1D5C6B1A1F2E5D3C6B4A5F1E2D3"
'play="C1A5D4D5F3B2B1A1C6D1F4B5D6E6F5C1B2F1E6D4E1F5D2F3F6A5E3B3C2B3D4F6F5B1A1F2E3D4C5B6A1F2E3D4C5B6A1F2E3D4C5B6FA1F2E3D4C5B6"
'play="C3E5D3C2B2A6A2E5B6E3F6B2F1F5E6F4E3B1A5C5E3A5C6B2A6B3A5E2C1F6A5D1A5B4D1C4B6F5F3B6D2C2E6B5C2F6E3C4B2D3B4F5C6A3C4B6D1A1C2B4A35D1F3C4B5E2D6E3D4A1F5C2B1A6F3E4C5D6C1F2E3D4B1A1C2B4A3335F3E1D4C5B6E2F3A1D4C5E6F2B3E4A1D2B5A1C3B6F4E2D3C5A4B1A5516F2E1D5C6F3E2B4A5D6C1B2F3A5E1D4C2B3A146F5E4D5C1B6A1F2E4C3B5D6A4C1B5A2F3E4D1C5B6E2D3F4E5C6DDBFFA1B2F3E4D5C6FFFA1B1F2E3D4C6B5A1F2E3D6C4B6A"
'play="A6D5F2C2F1A2F4E5D2F4B6E2A3A6C3F2A3D2B4A2E1D5E2C4D1B4A5B6F1A1E5C2C1E2F3D5A2F5D1E6B3A4D6C5A6E4B2A1F2E5C4D5B6D2F3F5E4C6F1B5E2C6D3B1C2A6B5A6F2E3D6F5E4C6B5D6A1C2B3E4A5D1C2B3A6F4E5D6C1B2F3A4E5D6F1E2C3D4C5B1A6F1E2D3C4B6F5E6A1F2E3D4B5C6A1B2F3E4A1D5C6B2A3F1E4D2C3B5A6F4E5D1C6B2F3A1E4D2C5B3A6F4E5D1C2B3A6F1E2D3C4B6F5E6A1F2E3D4B5C6A1F2E3D4B5C6A1B2A3F4E5D6C1F2B3A4E5D6C1B2F3A1E4D2C5B3A6F4E5D6F1C2E3B4A1D5C6F2E3D4B5C6A1F2B3E4D5A6F1E2C3B4A5D1C2B6A1F3E2D3C4B6A5F1E2D6C3B4F5A1E6"
'play="D1B4A5B3D2E1B6A2D1C3A4A6E1F6E5C2B4F2E5A6E2C1F6F2D5E3C5A6E2C3D5B6F4A4F2E5D6C1B2A3F6E4D5C1B2A6F3E1D2C4B5A6F3E4D1C5B2A6F1E2D3C4B5A1F6F2E3D4C5B6A1F2E3D4C5B6A1E2F3E4D5C6B1F2A3E1D2C4B5A6F3E1D2C3B4A6F1E5D2C3B4A6F1E2D3C5B4A6F5E1D2C6F3B4A1E5D2C3B4A6F1E2D3C5B6A4F1E2D3C5B4A6F5E1D2C3B4A6F1E2D5C3B4A6F5E6F1D2C3B4E5A6D1C2F3E4B5D6A1C2B3A4F1E2D3C5B4A6F1E5D6C2F3E4D5C6B1F2E3A1D2C4B5A6F1E3D2C4B3A"
play="D1B4A5B3D2E1B6A2D1C3A4A6E1F6E5C2B4F2E5A6E2C1F6F2D5E3C5A6E2C3D5B6F4A4F2E5D6C1B2A3F6E4D5C1B2A6F3E1D2C4B5A6F3E4D1C5B2A6F1E2D3C4B5A1F6F2E3D4C5B6A1F2E3D4C5B6A1E2F3E4D5C6B1F2A3E1D2C4B5A6F3E1D2C3B4A6F1E5D2C3B4A6F1E2D3C5B4A6F5E1D2C6F3B4A1E5D2C3B4A6F1E2D3C5B6A4F1E2D3C5B4A6F5E1D2C3B4A6F1E2D5C3B4A6F5E6F1D2C3B4E5A6D1C2F3E4B5D6A1C2B3A4F1E2D3C5B4A6F1E5D6C2F3E4D5C6B1F2E3A1D2C4B5A6F1E3D2C"
Set oArgs=WScript.Arguments ' tableau d'arguments
if oArgs.Count =1 then' nombre d'argument trasmis
play=oArgs(0) ' premier argument
end if
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("awale.txt", True)
dim lettre
maxboucle=500
yastop=false
dim cases(13)
dim save(13)
dim prev(13,12)
dim prevpossibles(12)
dim capt(13)
dim frappe
cases(13)=0
cases(0)=0
coups=0
'play="5B3D6D1E5B2B5E6F6B3F1D5A4B5E3A1F5E4D5A6E3"
random=false
auto=false ' passera à true si !
trainer=false
randomize
chef=false
started=false
tours=0
'play=""
Set oArgs=WScript.Arguments ' tableau d'arguments
if oArgs.Count =1 then' nombre d'argument transmis
play=oArgs(0) ' premier argument
end if
histo=""
init
ajeun=false
candidats=""
if len(play)>0 then
pile=instr("123456",mid(play,1,1))=0
else
xx=rnd
pile=xx>0.5
end if
'msgbox xx &" " & pile
while true
' vérifier si cases(?) = prev(?,1)
if started then
' chercher si actuel déja vue
' on compare à coup-12
' faudrait aussi tester le 10 poqssibles précedents
infini=true
for ii=0 to 13
if cases(ii)<>prev(ii,1) then infini=false
next 'ii
if infini then
a.writeline "OUF coups:" & coups&" identique à 12 au dessus now="&bacligne&" histo="&histo
'a.writeline bacligne
' a.writeline "yastop mis a true a coups="&coups
yastop=true
for ii=1 to 12
' a.writeline "examinon " & prevpossibles(ii)& " yastop avant="& yastop
if prevpossibles(ii)<>1 then
yastop=false
' a.writeline "explore yastop= fauwx car choix à "&coups-12+ii
end if
next 'ii
a.writeline "OUFet yastop="&yastop& " dernier joueur a été ="&joueur
end if ' infini
end if
if yastop then finir "OUF ++++ partie infinie à 2 pierres joueur était:"&joueur
coups=coups+1
' décaler les 11 précédents
for i=2 to 12
prevpossibles(i-1)=prevpossibles(i)
for ii=0 to 13
prev(ii,i-1)=prev(ii,i)
next ' ii
next 'i
for ii=0 to 13
prev(ii,12)=cases(ii)
next 'ii
if coups>maxboucle then finir "OUF ++++ cen partie infinie joueur était:"&joueur
'a.writeline "play="&histo
pile=not pile
if pile then
' a.writeline " c'est à sud de jouer"
joueur="Sud"
adversaire="Nord"
else
' a.writeline " c'est à nord de jouer"
joueur="Nord"
adversaire="Sud"
end if
' compter nb de coup possible
base=0
' possibles=0
x= liste 'pour avoir possibles!
' gaffe compte les deja a jeun
if not ajeun then candidats=liste
possibles=len(candidats)
prevpossibles(12)=possibles
' possible sera mis à zero après l'essai sans di random
while possibles>0
'a.writeline "possibles: " & possibles
'a.write bacligne & " ?"&liste& "("&candidats&")"
' preparer la ligne si reponse acceptee
projet=coups&":"&now & "-"& bacligne & " ? "&candidats
' conserver config pour si abandon en random
for i=0 to 13
save(i)=cases(i)
next 'i
' verifier si adversaire à zero
manger=0
if pile then
base=6
moi=0
else
base=0
moi=6
end if
'explore les cases de l'adversaire
for i=base+1 to base+6
manger=manger+cases(i)
next 'i
stock=manger
' adversaire de base à base +6
' chercher si je
if stock=0 then
a.writeline adversaire & " a zero faut le nourir " & bacligne
' vérifier si j'ai unechance de nourir adversaire
chance=false
if moi=0 then ' moi sud
for i=1 to 6
if cases(moi+i)>6-i then
chance=true
a.writeline "possible par case ("&moi+i&")="&cases(moi+i)'&">="&6-i
end if
next 'i
else ' moi nord=6
for i=1 to 6
if cases(moi+i)>6-i then
chance=true
a.writeline "possible pas casde ("&moi+i&")="&cases(moi+i)'&">="&6-i
end if
next 'i
end if
if not chance then a.writeline "impossible de le nourrir " & joueur & " gagne"
if not chance then finir "-OUF pas chance de nourrir adversaire "&joueur&" gagne"
end if
'
' pret pour un coup
'
j=-4
while j=-4
if random or (trainer and not pile=chef) then
'a.writeline "hasard "&joueur &" " &bacligne& "???" & liste
if len(liste)=0 then
finir "impssible de jouer pour "&joueur
end if
j=hasard
'a.writeline "hasard found rnd " & j & " candidats=" & candidats & " touche=" & lettre
else
j=-3
while j=-3
' a.writeline "appel de jeu"
j=jeu
' a.writeline "jeu a repondu "&j&" =="&lettre
wend
a.writeline 'sortie par j<>-3'
end if 'random/else
wend ' j =-4
started=true
' mémoriser le coup à jouer
histo=histo&lettre
'msgbox lettre & " " & j
' a.writeline "reponse ="& lettre & " j="&j
projet=projet & " ="& lettre
if j<0 then finir "abandon "
last=0 'dernière case de la distribution pour tester si capture
if j=0 then
a.writeline "invalide frappe "&lettre&" j="&j
if lettre<>"." then
msgbox "invalide frappe "&lettre
wscript.quit
end if
else
'a.writeline "distribution pile="&pile& " j="&j
'a.writeline "????? pile="&pile& " j="&j& " case="& cases(j)
if ((pile and j<=6) or (j>=7 and not pile) ) and (cases(j)>0) then
'a.writeline "faire pile="&pile& " j="&j& " case="& cases(j)
disp=cases(j)
cases(j)=0
start=j
t=j+1
repet=0
max=49
while (disp>0) and (max>0)
max=max-1
if max=0 then fini "boucle"
if t=13 then t=1
if t<>start then
cases(t)=cases(t)+1
'a.writeline "cases("&t&") now " & cases(t)
last=t
disp=disp-1
end if
t=t+1
'a.writeline "point 0"
wend 'disp >0
'a.writeline "point 1"
end if ' 6 ou 7
''a.writeline "point 2"
if last=0 then
a.writeline "apres distrib invalide last=0!"
if not random then msgbox "invalide last=0"
wscript.quit
pile=not pile
else
if pile then
seuil=7
ok=12
else
seuil=1
ok=6
end if
'a.writeline "point 4 last="&last& " seuil="&seuil
'a.writeline bac(true)
for i=1 to 12
capt(i)=0
next 'i
while (last >=seuil) and (last <= seuil+5)
if ( pile and last>6) or (not pile and last<=6) then
if cases(last)=2 or cases(last)=3 then
' a.writeline "capture " & pile &" "& last & " "&cases(last)
'msgbox "capture " & pile &" "& last & " "&cases(last)
if pile then
cases(0)=cases(0)+cases(last)
'a.writeline "cases(0) passe à "&cases(0)
else
cases(13)=cases(13)+cases(last)
end if ' nord sud
capt(last)=cases(last)
'a.writeline "memo capt("&last&") mis a" & capt(last)
cases(last)=0
last=last-1
else
last=0
end if ' 6ou 7
end if '?????
wend ' recul last
'a.writeline "point 5"
'a.writeline "fin de distribution, vérifier exceptions" & bacligne
' vérifier adversaire a une case non vide=encore à manger
manger=0
base=0
if pile then base=base+6
'explore les cases de l'adversaire
for i=base+1 to base+6
manger=manger+cases(i)
next 'i
ajeun=false
' if stock=0 and manger=0 then
if manger=0 then
' msgbox "adverdsaire serait affamé a joué: "&lettre
a.writeline "adversaire à jeun "&joueur& " avait joué: "&lettre & " < "&candidats
projet=""
' a.writeline bacligne
for i=1 to 12
cases(i)=save(i)
next 'i
histo=mid(histo,1,len(histo)-1)
a.writeline "remis ligne avant "&bacligne& " " & liste &" histo="&histo
candidats=liste
' bug
' OUF=(01001) ==22<A: 0 B: 0 C: 1 D: 1 E: 0 F: 0 1:0 2:0 3:0 4:0 5:1 6:0 >23 ?histo=C1E6A4E1C6B2F5E1F6C4D5A1E3D6A2B1D4A6C4B2F5E6D2F1C5E6C4B6D4F2A3D4B5C1A1E4D2B2F1D2E3A4B6C3A2B5A6F4E5D3C4B5A16F1E2D3C4A5B1A6F1E2D4C5B6F3E4A5D1C6B2F3A4E1D2C3B5A6F4E1D2C3B4A15F6F1E2C3B4A5D1C6F2B3E4D5C6BFA1F2B3A4E5D6F1C2B3A1E4D2C5B6A1F3E2D3C4B5A16E1F2E3D4C5B6F1A1E2D4C3B4A15F6E1F2E3D4B5C6FA1F2E3D4B5C6BFA1B2F3A1E4D2C3B4A15F1E2D3C6B4A1F5E2D6C3B4F5A1E6F2D3E4D5C6FA1B2A3F4E5D1C6F2E3D4C5B6F1E2D3A4C5B1A6F1E2D4C3B5A6F4E1D5C6F2E3B4D5A1C6F2E3B4A5D1C2B6F3E4D5C6FBA1B2F3E4D5A1C6B2F3E4D5C6FBA1F2E3B4A1D5C6B2F3E4A5D1C2B3A16F1E2D3C4B5A16F1E2C3D4B5A1C2B3A6F4E1D5C2B6F3E4D5C6FA1F2E3D4C5B6A1F3E2D3C4B6F5A6E1D2F3C4B5A6E1D2C3B4A1F5E2D3C6B4A1F5E6D2F3E4D5C6FBA1F2B3A1E4D5C6F2E3D4B5A1C6B2F3E4A5D1C2B3A6F1E4D5C2B3A146F4E5D6F1E2C3B4A1D5C6F2B3E4A5D1C6F2B3E4A1D5C2B6F3A4E1D2C3B5A416F4E1D2C5B6A1F2E3D5C6B4A1F5E2D3C4B5A16F1E2D3C4B5A126F2E1D2C3B5A6F1E2D3C4B5A16E1D2C3B4F5E6A1D2C3B4F5A6F1E2D3C4B5A216F1E2D4C5B3A16F1E4D2C5B6A1F3E4D5C2B6F3A4E5D6C' 1B2A1F3E4D5C2B3A16F1E2D4C3B5A416F4E5D1C2B3A6F4E1D2C5B6A1F2E3D5C4B6F5A1E6F2D3C4B5E6A1F2D3E4
' rejouer
pile=not pile
' oter lettre de candidats
a.writeline "cand="&candidats&"=====lettre="&lettre&"===="
xl=instr(candidats,lettre)
candidats=mid(candidats,1,xl-1) & mid(candidats,xl+1)
' a.writeline "candidats="&candidats
if trim(candidats)="" then
rest=0
for i=1 to 12
rest=rest+cases(i)
next 'i
if pile then
cases(13)=cases(13)+rest
'a.writeline "cases(13) rest passe a "& cases(13)
else
cases(0)=cases(0)+rest
end if
joueur=chr(asc(joueur)+32)
finir "impossible à "&joueur& " de nourrir adversaire. "
end if
ajeun=true
end if
if stock>0 and manger=0 then
' msgbox "impossible affamer adverdaire était: "&lettre
a.writeline "impossible affamer adverdaire serait"
a.writeline "manger" & bacligne
play=""
' annuler les captures chez l'adversqiares
for i=base+1 to base+6
cases(i)=capt(i)
'a.writeline "cases("&i&") restaure a " & cases(i)
if pile then
cases(0)=cases(0)-capt(i)
' a.writeline "cases(0) recukle a " &cases(0)
else
cases(13)=cases(13)-capt(i)
end if
next 'i
possibles=possibles-1
a.writeline "adversaire garde ses graines possibles="&possibles
' a.writeline bacligne
projet=bacligne
possibles=0
else
possibles=0
end if
'a.writeline "point 8"
end if
'a.writeline "point 9"
end if '******
if len(projet)>0 then a.writeline projet
wend 'possibles >0
' verif
check
wend 'true
sub check
tot=cases(0)+cases(13)
for i=1 to 12
tot=tot+cases(i)
next 'i
if (cases(0)>=25) or (cases(13)>=25) then
if cases(0)>=25 then g="sud" else g="nord"
finir g & " gagne"
end if
end sub
sub finir (comment)
'a.writeline comment & " stop=" & yastop
z="00000"&coups
z=mid(z,len(z)-4)
if z<1000 then z=mid(z,3)
sign="OUF"
a.writeline "OUf finir joueur="&joueur&" coups="&coups&" comment="&comment
if instr(comment,"++")>0 or coups>=maxboucle then joueur=joueur & " ++++ " & 48-cases(0)-cases(13)& " "
if yastop then
sign="ouf"
' joueur="_"
end if
if mid(comment,1,10)="OUF pas ch" then sign="ouf"
'a.writeline "Ouf finir comment="&comment
a.writeline sign&"=("&z&")"&joueur&"=="&now&"=="&bacligne& "histo="&histo
if not auto then msgbox comment & vbcrlf & bac (true),vbOk,titre& " ?" & coups
'if mid(comment,1,10)="OUF pas ch" then msgbox "pas de chance"
wscript.quit
end sub
function bac (fini)
haut=""
bas=""
for i=1 to 6
haut=haut & chr(64+i) & ":" & 0+cases(13-i)&" "
bas=bas & chr(48+i) & ":" & 0+cases(i)&" "
next 'i
if fini then
bac="Nord: "&cases(13) & vbcrlf & haut & vbcrlf & bas & vbcrlf & "Sud: " & cases(0)
else
bac="Nord: "&cases(13) & vbcrlf & haut & vbcrlf & bas & vbcrlf & "Sud: " &cases(0) & vbcrlf & joueur & "? "&liste & " (? pour help)"
end if
end function
function bacligne
haut=""
bas=""
for i=1 to 6
' a.writeline cases(i)& " " & cases(13-i)
haut=haut & chr(64+i) & ":" & cases(13-i)&" "
bas=bas & chr(48+i) & ":" & cases(i)&" "
next 'i
'if not pile then
'qui="1 2 3 4 5 6"
'else
'qui="A B C D E F"
'end if
bacligne=cases(13) & "<" & haut & bas & ">"& cases(0) & " ?" ' & "jeu: "&liste
end function
function jeu
'a.writeline "debut jeu"
alaide=false
while not alaide
if len(play)>0 then
' a.writeline "dans jeu joueuer="&joueur&" play="&len(play)&":"&play
if mid(play,1,2)="!*" then
a.writeline "recu !* de la ligne de commande"
play="*"
lettre="!"
else
lettre=mid(play,1,1)
play=mid(play,2)
end if
' a.writeline "accepté de play lettre="&lettre
if lettre="!" then
auto=true
jeu=-4
a.writeline "auto mis atrue traite ! de !* reste " & play
lettre=mid(play,1,1)
end if
if mid(lettre,1,1)="*" then
random=true
jeu=-4
a.writeline "random mis a true jeu=-4 eit"
exit function
end if
else
ok=false
while not ok
lettre=ucase(inputbox (bac(false),titre & " ?" & coups))
a.writeline "inputbox " & lettre
ok=instr(liste&"*!/?=",mid(lettre,1,1))>0
'a.writeline "ok is " & ok
' excepyions
if lettre="!" then
auto=true
jeu=-4
a.writeline "auto mis atrue traite ! de !* reste " & play
end if
if mid(lettre,1,1)="*" then
random=true
jeu=-4
a.writeline "random mis a true jeu=-4 eit"
exit function
end if
if lettre="?" or lettre="," then
help
end if
if mid(lettre,1,1)="=" then
'a.writeline "inhjecter " & lettre
' injecter
for i=0 to 13
cases(i)=0
next 'i
' au delàde =
lettre=mid(lettre,2)
' tant que pasépuisé
while len(lettre)>0
acible=ucase(mid(lettre,1,1))
if instr (": ",acible)=0 then
icible=instr("S123456FEDCBAN",acible)-1
lettre=mid(lettre,2)
if mid(lettre,1,1)=":" then lettre=mid(lettre,2)
' GAFFE q a un chiffre
q=mid(lettre,1,1)
' a.writeline "init " & icible & "="&cases(icible)
cases(icible)=q
a.writeline "init " & icible & "="&cases(icible)
end if
lettre=mid(lettre,2)
wend 'while len(lettre)>0
ok=false
'a.writeline "forge:"&bacligne& " cnad="&candidats&" liste="&liste
vide=bacligne
projet="forge="&bacligne & " ? "&liste
end if
wend 'while not ok
end if
'a.writeline "accepté (avant wend)" & lettre & " alaide="& alaide
alaide=true
'a.writeline "accepté (avant wend)" & lettre & " alaide="& alaide
wend ' while not alaide
'a.writeline "wend lecture lettre="&lettre
if lettre="" then
jeu=-1
exit function
end if
if mid(lettre,1,1)="/" then
trainer=true
randomize
lettre=""
chef=pile
jeu=-3
exit function
end if
if len(lettre)>1 then
play=mid(lettre,2)
lettre=mid(lettre,1,1)
end if
frappe=lettre
if lettre>="A" and lettre<="F" then
jeu=6+71-asc(lettre)
else
if lettre>="1" and lettre <="6" then
jeu=0+lettre
else
jeu=0
end if
end if
end function
function init
'a.writeline
cases(0)=0
cases(13)=0
for i=1 to 12
cases(i)=4
next 'i
end function
function liste
possibles=0
l=""
base=0
if not pile then base=base+6
if base=0 then
for i=base+1 to base+6
if cases(i)>0 then
possibles=possibles+1
l=l & nom(i)
end if
next 'i
else
for i=base+1 to base+6
if cases(i)>0 then
possibles=possibles+1
l= nom(i)& l
end if
next 'i
end if
liste=l
end function
function nom(rang)
if rang<1 or rang>12 then finir "demande idiotte pour rang="& rang
nom=mid("123456FEDCBA",rang,1)
end function
function hasard
candidats=liste
' chercher au hasard parmi les possibles dans la chaine candidats
found=false
while not found
jj=int(0.9999999+6*rnd(6))
if not pile then jj=jj+6
lettre=nom(jj)
found=instr(candidats,lettre)>0
wend
hasard=jj
end function
sub help
msgbox "mode d'emploi"&vbcrlf&_
"* pour terminer en automatique"&vbcrlf &_
"!* pour terminer en automatique sans dialogue"&vbcrlf &_
"pour continuer solitaire: / ",, titre
end sub