LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2I1EhRic=# 'T' pour Trahit et 'C' pour Coopereptscoop := 3; ptstrahit := 5; ptsesttrahi := 0; ptsechec := 1;Points:=proc(a1,a2)
if a1='T' then
if a2='T' then return [ptsechec,ptsechec]
elif a2='C' then return [ptstrahit,ptsesttrahi]
else return [ptstrahit,-infinity]
end if
elif a1='C' then
if a2='T' then return [ptsesttrahi,ptstrahit]
elif a2='C' then return [ptscoop,ptscoop]
else return [ptscoop,-infinity]
end if
else
if a2='T' then return [-infinity,ptstrahit]
elif a2='C' then return [-infinity,ptscoop]
else return [-infinity,-infinity]
end if
end if
end;PointsCumules:=proc(L)
return add(Points(op(a)), a in L)
end;Brouille := proc(coup,p)
if rand() mod 100 < p then
if coup='C' then return 'T'
else return 'C'
end if
else return coup
end if
end;Partie:=proc(nb,strat1,strat2,br)
local s,s1,s2,i,coup1,coup2:
s := NULL:
s1 := NULL:
s2 := NULL:
for i from 1 to nb do
coup1 := strat1([s]):
coup2 := strat2([s2]):
s := s,[coup1,coup2]:
s1 := s1,[coup1,Brouille(coup2,br)]:
s2 := s2,[coup2,Brouille(coup1,br)]
end do:
return [s]
end;Tour:=proc(nb,L,br) #L = liste de couples [nom, strat\303\251gie]
local nL,i,j,Lpts,pts:
nL := nops(L):
Lpts := [0$nL]:
for i from 1 to nL do
for j from i to nL do
pts := PointsCumules(Partie(nb,L[i][2],L[j][2],br)):
Lpts[i] := Lpts[i] + pts[1]:
if i<>j then Lpts[j] := Lpts[j] + pts[2] end if:
end do
end do:
return Lpts
end;Resultat := proc(L,Lpts)
local L2,cmp,n:
n := nops(L):
cmp := (x,y) -> x[3]>y[3]:
L2 := [seq([op(L[i]),Lpts[i]], i in 1..n)]:
L2 := sort(L2,cmp):
return L2
end;Tournoi := proc(nb,L,br) #L = liste de couples [nom, strat\303\251gie]
local t,res,n:
randomize(424242):
n := nops(L):
t := Tour(nb,L,br):
res := Resultat(L,t):
print(seq([res[i][1],res[i][3]], i in 1..n)):
end;Archibald := proc(L)
if L=[] then return 'C'
else return L[-1][2]
end if
end:Berthe := proc(L)
return 'T'
end:Cunegonde := proc(L)
return 'C'
end:Dagobert := proc(L)
local n,pc,pt,nc,nt,x:
n := nops(L):
if n<10 then return Archibald(L)
else
pc := 0: nc := 0:
pt := 0: nt := 0:
for x in L do
if x[1]='C' then pc := pc + Points(op(x))[1]: nc := nc+1
else pt := pt + Points(op(x))[1]: nt := nt+1
end if
end do:
if pc/max(nc,1)>=pt/max(nt,1) then
return 'C'
else
return 'T'
end if
end if
end:Eurial := proc(L)
local n,pc,pt,nc,nt,x:
n := nops(L):
if n<=0 then return 'C'
elif n<=1 then return 'T'
else
pc := 0: nc := 0:
pt := 0: nt := 0:
for x in L do
if x[1]='C' then pc := pc + Points(op(x))[1]: nc := nc+1
else pt := pt + Points(op(x))[1]: nt := nt+1
end if
end do:
if evalf(pc/max(nc,1)+sqrt(ln(n)/(max(nc,1)*n)))>evalf(pt/max(nt,1)+sqrt(ln(n)/(max(nt,1)*n))) then #algo UCB
return 'C'
else
return 'T'
end if
end if
end:Freyja := proc(L)
local n,p1,p2:
n := nops(L):
if n<=10 then return 'C'
elif n<=20 then return 'T'
else
p1 := PointsCumules(L[1..10])[1]:
p2 := PointsCumules(L[11..20])[1]:
if p1>p2 then
return 'C'
else
return 'T'
end if
end if
end:Aleatoire:=proc(L)
if rand() mod 100 < 50 then return 'C' else return 'T' end if
end:Teste := proc(strat)
randomize(691691);
return PointsCumules(Partie(50,strat,Aleatoire,0))
end;nbtours := 80 + (rand() mod 40):Paires := proc(L)
local LL,s,i:
LL := L:
s := NULL:
while nops(LL)>1 do
i := 2 + (rand() mod (nops(LL)-1)):
s := s,[LL[1],LL[i]]:
LL := [op(LL[2..i-1]),op(LL[i+1..-1])]
end do:
LL := [op(LL),op(L)]:
while nops(LL)>1 do
i := 2 + (rand() mod (nops(LL)-1)):
s := s,[LL[1],LL[i]]:
LL := [op(LL[2..i-1]),op(LL[i+1..-1])]
end do:
return [s]
end:Melange := proc(strat1, strat2)
return
proc(L)
if nops(L) mod 2 = 0 then
return strat1(L)
else
return strat2(L)
end if
end
end;MelangeTotal := proc(s1,s2)
return [cat(s1[1],s2[1]),Melange(s1[2],s2[2])]
end;StrategiesMelangees := proc(L)
randomize(393939):
return [seq(MelangeTotal(op(x)), x in Paires(L))]:
end;EstGentil := proc(strat)
local g,x:
g := Partie(100,strat,Cunegonde,0):
for x in g do
if x[1]='T' then return false end if
end do:
return true
end;Teste(Archibald); Teste(Berthe); Teste(Cunegonde); Teste(Dagobert); Teste(Eurial); Teste(Freyja);Lbase := [["Archibald",Archibald],["Berthe",Berthe],["Cun\303\251gonde",Cunegonde],["Dagobert",Dagobert],["Eurial",Eurial],["Freyja",Freyja]]:Audacieux:=proc(L)
n:=nops(L): j:='T':
for i from 1 to n do
if L[i][2]='T' then j:='T'
else j:='C'
end if end do : return j end;Teste(Audacieux);cool:=proc(L)
n:=nops(L);
a:=0;
b:=0;
c:=0;
d:=0;
if n<=10 then
for i from 1 to n do
if L[i][2]='T' then return 'T'
end if
end do;
return 'C'
else
for i from 1 to 4 do
if L[n-i]=['C','C'] then a:=a+1
elif L[n-i]=['C','T'] then b:=b+1
elif L[n-i]=['T','T'] then c:=c+1
else d:=d+1
end if end do;
if a<b then return 'T'
elif b>c then return 'T'
elif d<a or d<b or d<c then return 'T'
else return 'C'
end if
end if
end;Teste(cool);Magie:=proc(L)
n:=nops(L):
a:=0 :
for i from n-10 to n do
if L[i][2]='T' then
a:=a+1:
end if :
end do:
if a>7 then
return 'T'
else
return 'C'
end if :
end :Rancunier:=proc(L)
n:=nops(L):
a:=0 :
for i from 1 to n do
if L[i][2]='T' then
a:=1 :
end if :
end do:
if a=1 then return 'T'
else
return 'C'
end if;
end;Tchimboiseur:=proc(L)
n:=nops(L) :
if n<=15 then
return Rancunier(L):
elif n>15 and n<25 then
return 'C' :
elif n>=25 and n<38 then
return Magie(L):
elif n>=38 and n<49 then
return 'T':
elif n>=49 and n<59 then
return Magie(L):
elif n>=59 and n<64 then
return 'C':
elif n>=64 and n<78 then
return Magie(L):
elif n>=78 and n<83 then
return 'T' :
elif n>=90 and n<100 then
return Magie(L):
elif n>=100 and n<110 then
return 'C'
else
return 'T'
end if:
end :Teste(Tchimboiseur);Gentil:=proc(L) return 'C' end;Agressif:=proc(L)
n := nops(L):
m := 0:
for x in L do
if x[1]=x[2] then m := m+1 end if
end do:
if m > n/2 then return 'C' else return 'T' end if
end;
Mechant := proc(L) return 'T' end;Ray:=proc(L)
local k:
k:=rand() mod 100:
if k<10 then return Gentil(L);
elif k<20 then return Rancunier(L);
elif k<35 then return Agressif(L);
else return Mechant(L);
end if;
end proc;Teste(Ray);Balance:=proc(L)
local n:
n:=nops(L):
if n<3 then
return 'T'
else
if L[n-1][1]=L[n-1][2] and L[n][1]=L[n][2] then
if L[n][2]='C' then
return 'T'
else
return 'C'
end if:
else
if L[n][1]='C' then
return 'T'
else
return 'C'
end if:
end if:
end if:
end: Teste(Balance);Jules:=proc(L)
n:=nops(L);
L1:=PointsCumules(L);
if L1[1]>L1[2]
then return 'C'
elif L1[1]<L1[2]
then return 'T'
else return 'C'
end if;
end;Teste(Jules);Mis\303\251ricordieux:=proc(L);
n:=nops(L);
if n<=1 then return 'C';
elif n=2 and L[1][2]='T' then return 'T';
elif n=2 and L[1][2]='C' then return 'C';
elif n=3 and (L[1][2]='T' or L[2][2]='T') then return 'T';
elif n=3 and L[1][2]='C' and L[2][2]='C' then return 'C';
elif L[n-1][2]='T' then return 'T';
elif L[n][2]='T'then return 'T';
elif L[n-2][2]='T' and L[n-1][2]='C' and L[n][2]='C' then return 'C';
end if;
return 'C';
end:Teste(Mis\303\251ricordieux);Damien:=proc(L)
local n,total,demi;
n:=nops(L):
total:=PointsCumules(L):
demi:=PointsCumules(L[ceil(n/2)..n]):
if demi[1]<=ceil((total[1])/2) and demi[1]<=demi[2]
then return 'T'
else return 'C'
end if;
end;Teste(Damien);Adrien:=proc(L) #C'est mal de regarder sur internet !
if L=[] then
return 'C'
else return L[nops(L)][2]
end if:
end;Teste(Adrien);Bambi:=proc(L)
n:=nops(L):
P:=0:
for i from 1 to n do
if L[i][2]='T'
then P:=P+1
end if;
end do;
if P>=5*n/7 then return 'T'
elif P<=n*3/7 then return 'T'
else return Aleatoire(L)
end if;
end;Teste(Bambi);Aur\303\251lienGouhier:=proc(M);
n:=nops(M);
o:=0;
p:=0;
for i from 1 to n by 1 do
if M[i][2]='T' then o:=o+1
else p:=p+1
end if;
end do;
if o>=n/2 then return 'T'
else return 'C'
end if;
end proc;Teste(Aur\303\251lienGouhier);Marie:=proc(L)
if nops(L)<2 then return 'C'
elif PointsCumules(L[-2..-1])[1]<=3 then
return 'T'
else return 'C'
end if;
end;Teste(Marie);MarsAttaque:=proc(L)
n:=nops(L):
for i from 1 to n do
if L[i][2]='C' then return 'T'
end if;
end do;
return Aleatoire(L)
end;Teste(MarsAttaque);MikeBrant:=proc(L)
n:=nops(L) ;
a:=0 ; b:=0 ;
for i from 1 to n do
if 'T'=L[i][2] then
a:=a+1 ;
end if ;
end do ;
for j from 1 to n do
if 'C'=L[j][2] then
b:=b+1 ;
end if
end do :
if b>2*n/3 then return 'T'
elif b<n/3 then return 'T'
else return Aleatoire(L)
end if;
end ;Teste(MikeBrant);nbc:=proc(L);
x:=0;
if nops(L)=0
then return 0
elif L[1][2]='C'
then return 1+nbc(L[2..nops(L)])
else return nbc(L[2..nops(L)])
end if;
end;nbt:=proc(L);
x:=0;
if nops(L)=0
then return 0
elif L[1][2]='T'
then return 1+nbt(L[2..nops(L)])
else return nbt(L[2..nops(L)])
end if;
end;Mastrategie:=proc(L);
if nops(L)=0 then return 'T'
elif L[nops(L)][2]='T' then
return 'T'
else if nbc(L)>0.6*nops(L)
then return 'T'
else return 'C'
end if;
end if;
end ;Teste(Mastrategie);Popeyus:=proc(L);
if nops(L)<10 then return 'T';
end if;
if 25<nops(L) and nops(L)<50 then return 'T';
end if;
if 75<nops(L) and nops(L)<80 then return 'T';
end if;
if 85<nops(L) and nops(L)<90 then return 'T';
end if;
if 10<=nops(L) and nops(L)<=25 then return Aleatoire(L);
elif 50<=nops(L) and nops(L)<=75 then return Aleatoire(L);
elif 80<=nops(L) and nops(L)<=85 then return Aleatoire(L);
elif 90<=nops(L) then return Aleatoire(L);
end if;
end;Teste(Popeyus);Mechantmaispastrop:=proc(L)
Meme:=0;
Traitrise:=0;
for i from 2 to nops(L) do
if L[i][2]=L[i-1][2] then Meme:=Meme+1;
end if;
end do;
for j from 1 to nops(L) do
if L[j][2]='T' then Traitrise:=Traitrise+1;
end if;
end do;
if Traitrise<=1 then return 'C'
elif nops(L)<=20 then return 'T'
elif Traitrise>=(3*nops(L))/4 then return 'T'
elif Meme>=(9*nops(L))/10 then return 'T'
else return Aleatoire(L)
end if;
end proc;Teste(Mechantmaispastrop);Mechant:=proc(L):
return('T'):
end:Strategie:=proc()
local L, c, i, r:
L:=[]:
c:=0:
r:=0:
for i from 1 to nops(L) do:
if L[i][2]='C' then:
c:=c+1:
end if:
if (L[i][2]='C' and L[i+1][2]='C') or (L[i][2]='T' and L[i+1][2]='T') then:
r:=r+1:
end if:
end do:
if c > nops(L)-c and r > nops(L)-r then:
return 'T':
elif c <= nops(L)-c and r <= nops(L)-r then:
return Mechant(L):
end if:
end:Teste(Strategie);Vincent := proc(L) local e,i;
e:=0:
if nops (L) = 0 then
return 'C';
else
for i from 1 to nops(L) do
if L[i][2] = 'T' then
e:=e+1;
else e:=e;
end if;
end do;
if e>= 13/21*nops(L) then
if (rand() mod 10)<9 then
return 'T':
else
return 'C':
end if;
elif e<= 10/21 then
return 'C';
else
if (rand() mod 100)< 41 then
return 'T':
else return 'C'
end if;
end if;
end if;
end;Teste(Vincent);Genevieve:=proc(L)
a:=0:
n:=nops(L):
if n<10 then
return Aleatoire(L)
end if:
for i from n-3 to n do
if L[i][2]='T' then
a:=a+1:
end if
end do:
if a=3 then
return 'T'
elif a=0 then
return 'T'
elif a=2 then
return 'C'
else return 'C'
end if
end;Teste(Genevieve);strat\303\251gie1:=proc(L)if nops(L) mod 2=0 then return 'T'else
for i from 1 to nops(L) do
if L[i][2]='T' then return 'C' end if
end do:
return'T'
end if end;Teste(strat\303\251gie1);LeMyst\303\251rieux:=proc(L);
if nops(L)<14 then return 'T'
elif L[14][2]='T' then return 'C'
elif 14<nops(L)and nops(L)<21 then return 'T'
elif 20<nops(L)and nops(L)<50 then return Rancunier(L)
elif 49<nops(L)and nops(L)<75 then return Agressif(L)
elif 74<nops(L)and nops(L)<85 then return T
else return Gentil(L)
end if;
end proc;Teste(LeMyst\303\251rieux);Paple:= proc(L)
n:= nops (L):
r:=rand() mod 2:
if n<=2 then return Aleatoire(L)
elif L[n][2]=L[n-1][2] and L[n-1][2]=L[n-2][2] and L[n-2][2]='T'
then return 'T'
elif L[n][2]=L[n-1][2] and L[n-1][2]=L[n-2][2] and L[n-2][2]='C'
then return 'C'
else if r=0 then return 'C'
else return 'T'
end if: end if:
end;Teste(Paple);MaProcedure:=proc(L)
local i,n:
i:=nops(L):
if nops(L)=0 then return 'T'
elif i>5 then
if L[i-5][2]=L[i-4][2] and L[i-4][2]=L[i-3][2] and L[i-3][2]=L[i-2][2] and L[i-2][2]=L[i-1][2] and L[i-1][2]= L[i][2] then return 'T'
end if:
elif PointsCumules(L)[2]>PointsCumules(L)[1] then return 'T'
elif PointsCumules(L)[2]=PointsCumules(L)[1] then return 'T'
elif PointsCumules(L)[2]<PointsCumules(L)[1] then return 'C'
end if:
return Aleatoire(L)
end;Teste(MaProcedure);Rancuni\303\250re:=proc(L)
n:=nops(L):
x:=0:
for i from 1 to n do
if L[i][2]='T' then x:=x+1
end if:
end do:
if x=0 then return 'C'
else return 'T'
end if:
end;Teste(Rancuni\303\250re);Strategie_v:=proc(L)
local compt_t,i:
compt_t:=0:
for i from 1 to nops(L) do
if L[i]='T' then
compt_t:=compt_t + 1:
end if:
end do:
if nops(L)=0 then return 'T':
elif nops(L)<=15 then
if compt_t >= (floor(nops(L)/2)-1) then
return 'T':
else return 'C':
end if:
else
if compt_t >= (nops(L)/2) then
return 'T':
else return 'C':
end if:
end if:
end;Teste(Strategie_v);Olivier:=proc(L)
i:=nops(L):
if i<=5
then return Aleatoire(L)
else
if i mod 5 =0 then return 'C'
elif L[i-1][2]='C' then return 'T'
else return Agressif(L)
end if
end if
end;Teste(Olivier);Strat\303\251gie2:=proc(L)
nombre1:=0;
nombre2:=0;
for i from 1 to nops(L)-1 do
if L[i][1]=L[i][2]
then nombre1:=nombre1+1
else
nombre2:=nombre2+1
fi;
od;
if nombre2 mod 3=nombre1 mod 5
then return 'C'
else
return 'T'
fi;
end;Teste(Strat\303\251gie2);Natalie:=proc(L)
n:=0:
for i from 1 to nops(L) do
if L[i][2]='C' then n:=n+1
end if end do:
if n=nops(L) then return 'T'
elif n=0 then return 'T'
elif n>nops(L)-n-2 then return 'T'
else return 'C'
end if
end;Teste(Natalie);dhsy3502 := proc (L) n := nops(L); t1 := 0; c1 := 0; t2 := 0; c2 := 0;
if n <= 5 then return 'C' end if; for i to n do if L[i][1] = 'T' then t1 := t1+1 end if; if L[i][1] = 'C' then c1 := c1+1 end if; if L[i][2] = 'T' then t2 := t2+1 end if; if L[i][2] = 'C' then c2 := c2+1 end if end do; if t2 <= 10 then return 'T' end if; if t2+10 <= c2 then return 'T' end if; if c2+10 <= c1 then return 'T' end if; if L[n][2] = L[n-1][2] then return 'T' end if; if L[n-1][2] = 'C' then return 'C' elif L[n][2]='T' then return 'T' end if: return Aleatoire(L) end proc;Teste(dhsy3502);fzf:=proc(L)
if L=[] then return 'T'
elif nops(L)=1 then return 'T'
elif L[nops(L)][2]='C' and L[nops(L)-1][2]='C' then return 'T'
elif L[nops(L)][2]='T' and L[nops(L)-1][2]='T' then return 'C'
elif L[nops(L)][2]='T' and L[nops(L)-1][2]='C' then return 'C'
elif L[nops(L)][2]='C' and L[nops(L)-1][2]='T' then return 'T'
end if end;Teste(fzf);Giachetti:=proc(L)
if nops(L)=0 then return C
elif nops(L)>2 then
if L[nops(L)][2]='C' and L[nops(L)-1][2]='C' then
if PointsCumules(L[nops(L)-5..nops(L)])[2]>12 then return 'T'
else
if Points(op(L[nops(L)]))=[0,5] then return 'T'
elif Points(op(L[nops(L)]))=[3,3] then return 'C'
elif Points(op(L[nops(L)]))=[5,0] then return 'C'
elif Points(op(L[nops(L)]))=[1,1] then return 'C'
end if;
end if
end if;
if L[nops(L)][2]='T' and L[nops(L)-1][2]='T' then return 'T'
end if;
else
if Points(op(L[nops(L)]))=[0,5] then return 'T'
elif Points(op(L[nops(L)]))=[3,3] then return 'C'
elif Points(op(L[nops(L)]))=[5,0] then return 'C'
elif Points(op(L[nops(L)]))=[1,1] then return 'C'
end if;
end if;
return Aleatoire(L)
end;Teste(Giachetti);Moi:=proc(L)
a:=0:
b:=0:
for i from 1 to nops(L) do
if L[i][2]='C' then a:=a+1
elif L[i][2]='T' then b:=b+1
end if;
end do;
if a>b+floor(a/2) then return 'T'
elif a<b+floor(a/2) and a>b then return 'C'
else return 'T'
end if;
end;Teste(Moi);NomVaguementDiscriminant:=proc(L) local i,content,pascontent,Liste;
content:=0; pascontent:=0; Liste:=[C,T];
if L=[] then return Liste[(rand() mod 2)+1]
else for i from nops(L-3) to nops(L) do if L[i][2]=T then pascontent:=pascontent+1 else content:=content+1 end if end do;
if content>pascontent then return C
elif pascontent>content then return T
else return Liste[(rand() mod 2)+1] end if end if end;Teste(NomVaguementDiscriminant);PasMoi:=proc(L)
n:=nops(L):
if nops(L)<=5 then return 'T'
end if:
if n mod 20 = 0 then return 'T'
end if:
if L[n][2]=L[n-1][2] and L[n-1][2]='T' then return 'T'
elif L[n][2]=L[n-1][2] and L[n-1][2]=L[n-2][2] and L[n-3][2]=L[n-2][2] and L[n][2]='C' then return 'T'
end if:
a:=0:
b:=0:
if n>5 then
for i from 2 to n do
if L[i][2]='T' and L[i-1][1]='C' then a:=a+1
end if:
end do:
if L[n][1]='C' then return 'T'
else return 'C'
end if:
end if:
return 'C'
end;Teste(PasMoi);RamyNicolas:=proc(L)
if nops(L)<11 then return 'C'
else
return L[nops(L)-1][2]
end if:
end proc;Teste(RamyNicolas);StratgiedeSamuel := proc (L)
p := nops(L);
if p<2 then return 'C' end if;
if 10 <= p then
n := 0;
for x in L[p-9 .. p] do
if x[2] = 'T' then n := n+1 end if
end do;
if 3 <= n then return 'T' end if
end if;
if 4 <= p then
n := 0;
for x in L[p-3 .. p] do
if x[2] = 'T' then n := n+1 end if
end do;
if 2 <= n then return 'T' end if
end if;
if PointsCumules(L[p-1 .. p]) = [2, 2] then return 'C' end if;
if L[p-1] = L[p] then
if L[p][1] = 'C' then return 'T' else return 'C' end if
end if;
if Points(op(L[p])) = [3, 3] then return 'C' end if;
y := [1, 1, 2][1+(rand() mod 3)];
return ['C', 'T'][y]
end proc;Teste(StratgiedeSamuel);Strat\303\251gieefficace:=proc(L)
if nops(L)=0 then return Aleatoire([])
elif nops(L)=1 then return C;
elif nops(L)=2 then return C;
elif nops(L)=3 then return C;
elif nops(L)=4 then return T;
elif nops(L)=5 then return T;
elif nops(L)=6 then return C;
elif nops(L)=7 then return T;
elif nops(L)=8 then return C;
elif nops(L)=9 then return T;
end if;
if L[nops(L)-1][1]=C and L[nops(L)-2][1]=C then
if L[3][2]='T' then return 'T';
else return 'C' fi;
elif L[nops(L)-1][1]=T and L[nops(L)-2][1]=C then
if L[9][1]='T' then return 'T';
else return 'C' fi;
elif L[nops(L)-1][1]=T and L[nops(L)-2][1]=T then
if L[6][2]='T' then return 'T';
else return 'C' fi;
fi;
return 'T';
end;Teste(Strat\303\251gieefficace);Thibault:=proc(L);
if nops(L)=0 then return 'C';
elif nops(L)=1 then return L[-1][2];
elif L[-2][2]=L[-1][2] and L[-1][2]='C' then return 'T';
else return L[-1][2];
end if;
end proc;Teste(Thibault);Winston:=proc(L)
if rand() mod 3 = 0 then
return 'T'
elif rand() mod 3 = 1 then
return 'T'
else return 'C'
end if
end proc;Teste(Winston);Ziemendorf:=proc(L)
local N,k,Motif1,Motif2,J1,J2,i,l,J3,J4,Tot1,Tot2;
N:=nops(L);
k:=((N-1) mod 4)+1;
Motif1:=['T','T','C','C'];
Motif2:=['T','C','T','C'];
if N<=19 then return Motif1[k];
elif N>=20 and N<=39 then return Motif2[k];
else
J1:=0;
J2:=0;
for i from 1 to 20 do
J1:=J1+Points(op(L[i]))[1];
J2:=J2+Points(op(L[i]))[2];
end do;
Tot1:=J2-J1;
J3:=0;
J4:=0;
for l from 21 to 40 do
J3:=J3+Points(op(L[l]))[1];
J4:=J4+Points(op(L[l]))[2];
end do;
Tot2:=J4-J3;
if Tot2>Tot1 then return Motif2[k];
elif Tot1>Tot2 then return Motif1[k];
else return 'T';
end if;
end if;
end proc;Teste(Ziemendorf);Leleves := [["Damien",Damien],["Mis\303\251ricordieux",Mis\303\251ricordieux],["Balance",Balance],["Jules",Jules],["Cool",cool],["Audacieux",Audacieux],["Tchimboiseur",Tchimboiseur],["Ray",Ray],["Aur\303\251lienGouhier",Aur\303\251lienGouhier],["Marie",Marie],["MarsAttaque",MarsAttaque],["MikeBrant",MikeBrant],["Valentin",Mastrategie],["Popeyus",Popeyus],["Mechantmaispastrop",Mechantmaispastrop],["LouisV",Strategie],["Vincent",Vincent],["Bambi",Bambi],["AdrienTriche",Adrien],["Genevieve",Genevieve],["jgjgjgjgjgjgjgjgjgj",strat\303\251gie1],["LeMyst\303\251rieux",LeMyst\303\251rieux],["Paple",Paple],["Quentin",MaProcedure],["Rancuni\303\250re",Rancuni\303\250re],["Vinh",Strategie_v],["Olivier",Olivier],["Lituanie",Strat\303\251gie2],["Natalie",Natalie],["dhsy3502",dhsy3502],["fzf",fzf],["Giachetti",Giachetti],["Moi",Moi],["NomVaguementDiscriminant",NomVaguementDiscriminant],["RamyNicolas",RamyNicolas],["Thibault",Thibault],["Winston",Winston],["Ziemendorf",Ziemendorf],["StratgiedeSamuel",StratgiedeSamuel],["Strat\303\251gieefficace",Strat\303\251gieefficace]]:Lstrats := [op(Lbase),op(Leleves)]: print(seq(x[1], x in Lstrats)):Tournoi(nbtours,Lstrats,0):Tournoi(nbtours,Lstrats,5):Tournoi(nbtours,Lstrats,20):StrMel := StrategiesMelangees(Lstrats): print(seq(x[1], x in StrMel)):Tournoi(nbtours,StrMel,0):Tournoi(nbtours,StrMel,5):Tournoi(nbtours,StrMel,20):nbgentil := 0: nbmechant := 0: for x in Lstrats do
print(x[1],EstGentil(x[2])):
if EstGentil(x[2]) then nbgentil := nbgentil+1 else nbmechant := nbmechant+1 end if
end do:
print("Nombre de strat\303\251gies gentilles", nbgentil):
print("Nombre de strat\303\251gies m\303\251chantes", nbmechant):LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2I1EhRic=