# whis_simu.py

Created by florian-allard

Created on July 27, 2024

29.7 KB

Adaptation du mini-jeu de cartes WHIS que l’on trouve dans le jeu Tales of Eternia. Version jouable depuis le simulateur. La version calculatrice est disponible ici : WHIS

```from random import randint#,seed
from kandinsky import *
from time import sleep
from ion import *#keydown,KEY_RIGHT,KEY_LEFT,KEY_EXE,KEY_SHIFT

#seed(7)
#orange=(250,200,120)

def IMG(carte,x,y,quecadre=False):
C= carte[-1] in "mso"
if not quecadre:
for j in range(57-28*C):
for i in range(22-11*C):
clr=ord(Image[carte][22*j//(1+C)+i])-35
#clrs=(clr//(8**4),(clr//(8**3))%8,(clr//(8**2))%8,(clr//8)%8,clr%8)
for k in (0,1):
if 2*i+k<43:
CLR=Palette[carte][(clr//(8**(1-k)))%8]
set_pixel(x+2*i+k,y+j,CLR)
if C:
set_pixel(x+42-2*i-k,y+j,CLR)
set_pixel(x+2*i+k,y+57-j,CLR)
set_pixel(x+42-2*i-k,y+57-j,CLR)

clrH,clrB,clrHf,clrBf=couleurs(carte)

for k in (0,1):
X1=x-1+44*k
X2=x-2+46*k
fill_rect(x-1,y-2+60*k,45,1,(clrH,clrB)[k]) # haut et bas
fill_rect(X1,y-2,1,23+14*k,clrH) # haut gauche et haut droite
fill_rect(X1,y+58-37+14*k,1,37-14*k,clrB)
fill_rect(x-2*k,y-1-2*k,43+4*k,1,clrHf) # haut et haut haut
fill_rect(x-2*k,y+57+2*k,43+4*k,1,clrBf) # bas et bas bas
fill_rect(X2,y-3,1,24+14*k,clrHf) # haut gauche et haut droite
fill_rect(X2,y+59-38+14*k,1,38-14*k,clrBf) # bas gauche et bas droite

if carte=="Pio":
for i in range(7):
fill_rect(x-2,y+58+i,47,1,(clrB,clrBf)[i%2]) # hachures

def couleurs(carte):
if carte[0]=="T":
clrB,clrH=("rgb"["fve".index(carte[k])] for k in (1,2))
else:
clrB=(("yellow","gray")[carte=="Obs"],"brown")[carte=="Pio"]
if carte[0] in "FVE":
clrB="rgb"["FVE".index(carte[0])]
clrH=clrB

#couleurs foncées de la carte
clrBf,clrHf=((150*(k=="r"),150*(k=="g"),150*(k=="b")) for k in (clrB,clrH))
if clrB in ("yellow","gray","brown"):
clrBf=(100-50*(clrB=="brown"),100-50*(clrB=="brown"),100*(clrB=="gray"))
clrHf=clrBf

return clrH,clrB,clrHf,clrBf

def actu_jr(n,clr=(250,200,120)):
X=10+105*(n==2)+210*(n==3)
Y=10+70*(n==0)
if n==0:
fill_rect(0,125,320,97,"w")
L=len(Mains[0]) # affichage de la main du joueur
for i in range(L):
IMG(Mains[0][i],12+min(50,251//max(1,L-1))*i,150)
draw_string("J{}    ={:<2d}".format(n+1,len(Mains[n])),X,Y,"k",clr)
draw_string("\u25ae",X+50,Y,"gray","brown")
draw_string("Score{:>+4d}".format(scores[n]),X,Y+16,"k",clr)

def condition(p,mode):
if mode==1:
return nb_atq>0 and Jeu[-1][1:]=="tq" and Mains[jr][p][1:]=="tq"
elif mode==2:
return not nb_atq and (clr_atd in Mains[jr][p][0:2].lower())
elif mode==3:
return not nb_atq and (Mains[jr][p][0] in "LO") # Lum ou Obs

def traitement(p):
global sens, nb_atq, tour_fini, rejouer, clr_choisie
actu_jr(jr,"g")
Jeu.append(Mains[jr].pop(p))
tour_fini=True
nb_atq += Jeu[-1][1:]=="tq"
sens *= (-1)**(Jeu[-1]=="Vsp") #Change
fill_rect(244,50,36,36,"orange")
for k in (1,0): # flèche du sens
fill_rect(254+16*k,60,2,16,"purple")
draw_string("\u2192"*k,263,60-8*sens,"purple","orange")
fill_rect(255,75-16*k,16,2,"purple")
rejouer= Jeu[-1]=="Fsp" #Double
if Jeu[-1] in ("Esp","Lum","Obs"):
if jr!=0:
(Ne,Nf,Nv)=(sum((elt in Mains[jr][k][0:2].lower()) for k in range(len(Mains[jr]))) for elt in "efv")
clr_choisie="efv"[(Ne,Nf,Nv).index(max(Ne,Nf,Nv))]
else:
draw_string("choisir l'élément",130,127,"purple")
pos=1
chg=-1
while keydown(KEY_EXE):1
while not keydown(KEY_EXE):
if chg:
pos=(pos+chg)%3
fill_rect(229,88,80,36,"brown")
for i in (0,1,2):
D=(i==pos)
fill_rect(238+22*i-4*D,97-4*D,18+8*D,18+8*D,"rbg"[i])
sleep(0.2)
chg=keydown(KEY_RIGHT)-keydown(KEY_LEFT)
fill_rect(229,88,80,36,"w")
clr_choisie="fev"[pos]
IMG(Jeu[-1],114,65) # carte en jeu
if Jeu[-1] in ("Esp","Lum","Obs") and clr_choisie!="":
fill_rect(139,62,20,20,"rgb"["fve".index(clr_choisie)])#Aff_carte()

def cp_ok(jr):
for i in range(len(Mains[jr])):
for m in (1,2,3):
if condition(i,m): # si on a une carte jouable
return True
return False

def pioche(jr):
global Perdant,tour_fini,deja_pioche,nb_atq
actu_jr(jr,"r")
deja_pioche=True
for n in range(max(1,2*nb_atq)): # si nb_atq==0, ça fait 1 tour
if len(Mains[jr])==15:
Perdant=jr
tour_fini=True
break
Mains[jr]=sorted(Mains[jr]+[Jeu.pop(randint(0,len(Jeu)-2))])
for carte in ("Fsi","Pio"):
sleep(0.5)
IMG(carte,172,60,True)
if nb_atq:
tour_fini=True
nb_atq=0
actu_jr(jr,"r")

Palette={'Vsi':((125,198,192),(175,229,239),(111,169,162),(151,201,200),(149,159,160),(123,125,124),(181,200,198),(255,255,255)),'Vtq':((136,193,187),(125,132,136),(172,181,176),(255,255,255),(126,129,99),(131,124,81),(88,90,85),(81,93,131)),'Vsp':((132,190,182),(194,220,220),(165,177,175),(115,121,123),(112,115,76),(168,171,123),(224,231,177),(255,255,255)),'Esi':((37,58,69),(60,84,105),(78,114,133),(142,168,177),(106,145,165),(100,155,198),(129,185,215),(179,215,230)),'Etq':((63,84,106),(90,125,146),(119,120,115),(156,171,176),(71,74,72),(124,172,201),(195,196,155),(114,96,52)),'Esp':((211,170,81),(98,138,160),(38,140,237),(54,86,104),(105,109,114),(152,192,213),(213,88,81),(157,58,175)),'Fsi':((147,89,48),(101,58,31),(208,131,86),(243,188,107),(250,155,84),(248,239,132),(255,255,185),(255,255,255)),'Ftq':((161,82,44),(243,140,77),(243,229,125),(90,54,30),(117,107,79),(155,161,153),(255,255,255),(90,99,116)),'Fsp':((153,91,66),(102,61,36),(139,108,74),(236,151,81),(196,167,71),(196,135,100),(250,223,119),(255,255,255)),'Tev':((146,136,103),(175,174,132),(171,165,160),(90,91,94),(141,201,131),(95,206,89),(228,239,230),(132,130,131)),'Tvf':((100,78,44),(87,77,56),(165,169,112),(144,134,93),(118,99,72),(172,131,102),(56,37,26),(197,200,156)),'Tfe':((81,70,195),(124,121,207),(91,92,178),(153,160,218),(180,219,230),(89,131,154),(255,255,255),(133,182,204)),'Lum':((133,191,102),(132,146,74),(99,105,44),(177,182,126),(175,183,152),(127,129,97),(227,232,201),(247,219,109)),'Obs':((119,96,117),(75,54,36),(106,94,58),(56,2,58),(92,38,101),(120,65,121),(80,36,67),(158,150,150)),'Pio':((188,189,131),(95,98,43),(78,94,91),(80,69,123),(148,154,151),(142,76,22),(197,205,199),(106,54,54))}
Image={'Vsi': '###\$##3#3+##+3#3#\$#####53#+\$#\$##33#,#\$#+#53#%3%3+#\$,+5553,=HC+5#5####3+%\$,;&(6HPPPO;3###%%3#+#;>568HPPPGPP35%#5%\$#%\$-3HGYHOGGGPP\$%%3M##&-\$/GIbWGGGYHOF&#%K535&=5GZbWIYYYWGG\$%353%3&=GIbaGYbYZYYV66>;5#3#.HIbWGZbYbaYXF.>>+#33%7IYGIbaYbbYWPPGF3;#33HPGGZbYYbbYGGGPHM>=638POGYYGZbaWGGWGGGV>.3#HPGGGIbbYYYYYIYGO156>;@PHOYZWIYYYYYYGGHPP><+PPGIYGYbaYYYYGYGHPPT,+PPPGGYYYZYYWYYWGHGF5,+7PPPOGIYYYYZaWPGGGA5>;8PPHPGGIYZbaGPGGGP5>6;?OGPPOYbaYZYGGGGGOVV6+,>/PGGYGGWGGGGYYHOYVA+5>YHPPPOGHOIZbaGPHIWHC>1Y@PPOGIYZbbYWHPPIWH3<1YGHPPGYYbbbY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bX,,.4,,0YE>=5>>=5+5EGYX,,64,,,QG56>>>54C#\$GaL,,5=55T0O6>>=5,6+##GYL-55=54,1P>>=554,###GY,,56>>5,,X6=>=5,S###7Q,-5>>>5557L6>=-7+###7Q,-5>>>>=50YP/,-4####'Q,5>>>>=4,XI0WWD####=8L55>>>>5,,XI1QGD-33##'L555>>>5,TWD2RaGGD##55P,,-=>55,0WG2YZaWG3>>=HTT5565,,0YL1X,,aG3>>=GL15,64,,QaGZa,P1D#>54GXD,,-4,,QYG,aTL_D#,,,GYT,,-4,0YbG,1T,WD+,-67JYT,,4,X\\2W,,Y1G-3##%/1YY,,4bQa,W,,YbG6;#337J,aZb4YL2\\WD,1aG>;#=37I,,YY,`Z,,WE40_M>;#%5/I2\\1Z,abYG/E10WE53##5,I2\\bYTYIGGGD,,OF=+#%%,IaaYXPPQGG55,,OD63##\$TGYGGGPG56>>=41O,63##\$1GG/IX,55>>5554P,53##%\$D4WJ`,,5>654,7P,53###%54WZY,,-=55,TXL55+###%%%GZaT,-=,41,XE54+###%#5DT1T,-4,,,1W65,3####>\$I2,Y,-,,,0ZG5,-3####%'I2\\Yb-,,,OYG,-63#####7I,,`a-T,QZ_I->>;#####/GYb`Z,bXZZWE>>>3#####,/GIaZ2aQ\\2WF>>=3####,5,/GGYZY\\,2W6>>53####,,4,/GPYZ\\22G6>=5++###,,5-54HPIY,1E>=4,+####1,5555>7IGIaG=4,\$#####),5555>>=GGGD,,+######\$T,555>>>=GGO,#&>;###+#1T,555554,,6>>>>3#####\$,,,,,1D,6>>>=6>;#####\$-4,,,555>5555>>;", 'Vsp': '#########+#%6>GPPGG>;#####+\$#\$#%?PQYYPPPOGF####;+##%P8TbYYXPPOGGG;####+&@QbbbaXPPPOOGGG;####&HZbbaPPGGGGGGGGG;###GQbbaXQYXOG??GGG>?;;&HZbbYQbbXM5O>2OFFF>;?HbbbYYbb-5,55F\$7G>>>#QbbbPbb\\54,5>>>%45??;#bbaPRb-4,55556>,\\6>>##bYOQa84552b-5=:\\55>###XOHPM554b\\5552b6=63+##OGO=554b\\,2-2b-6>;#+##?G>=65,,\\b]:b,-6=,####GF=>>52,2-:b2b->4+##\$+56<6>55555,2b-5>%%3,,+,+=64>=6=,4\\,,5555>#,+###%56>=552bb],bb5>######4,]6>=4b\\,2bb->3###+##%4\\5=2b-4bb\\55=33#+,%,+5-54,552b-5-6=,-\$+##,#%6=55>554bb55#4+###-5#:.=55>5,bb->:+%5+#\$,,4,-4->5:b,,55=,4,,##+45,44->5552\\55=]43-####5,b5->55b\\4\\64-3##+#\$,,,b,-54b\\,b]=,,,,#+#%\$,,4,]=4-:bb5=,,,43##\$#,-5b\\65:bb-65%,-\$#+#%\$,-:->=4bb54555,,43#+\$,,555>52\\52-==4],,#+###554->=55b]55=>]5##+#+4644565:b\\4,64>2=6,#\$,,5=54bbbbbb->->,464##-5#>54,552b\\64564<5=###,3%5>55,2b]5-56-456#,%,+5,>52bb\\,4,546455++##%4\\6=5,,,2b]5\\5-5>+###5,\\655,bbbb5:-=55>#####%]6=4bbb\\54b6556;#,+#-,566=b\\-52b]=b]>\$+,,+-%=6:65b\\bb\\52b-=,+,##%,=65\\552\\-52b]6;\$+####\\>5=5-55-5bb\\->##+##+##>5552bbbbbbU>#\$,[#####&=552bbbbbUF;\$2bS#####-F55bbbba8F4,bbY[##+##,>>MYZY8O5bbaabb[#####\$&?GGGGEQZYZbbbb[######.HPXXQYYYYbbbbbS;###+\$-?PYYYYbbbbbbbYC##\$##\$+6HPYYYbbbbbY8F;####+###?HQYYbbbYOG>######+#\$,+6?GPPPGF########;+#\$,+##>=####+########+\$#\$+####,+\$#+#######\$#####+##+####\$####', 'Esi': '\$####\$###-655D#-,5##,+#####\$##\$,,,/557+,+##+\$#####\$-<,,\$5GG7+#####-+###+->D,,,5GGF+#####F3\$,55F?,-=5,-4F4,,,+#?47?GG?5,7E5,-,7=,7E+#57?GGG=-7HG5555I`GGE,#57555G5-GYGGE5GRPPG5,#GE755G5-FIYYYAW>?G7O4+G5555GE7AYbYYb^?FE7PG355G57GGFRbaYZb^GG?5HO3-57G5GQZZaYPQR?GHG56?;55GYGHbbbaYXOQYHQQ?GF;565QaQbbbbZYYXQYYZE5GC7?GJaYbbbbaZaXYYIbE7GCJWGZZaZbbbbbaZaYYZVGFC6V>bbaYZYbbbbbbbYaFGFC7VIbaYXZbbbbbbbbaaIGEC7PQaYYPQbbZbbbabYaGWG3EHQaYXPZbbbbbbYaZaGY>3FAQaXYPZbbbbbbbZbaAa>;EFObaYYaZbbbbbbaYW>G5C5G>BYZZYZbbbbbbYYOF?GC7EAAPYbZbbbbbYa`HIGXWC5G?IQYbaZbbbbXYOG?GGOCGGGYbbXaYbZaYYZYN?GI?;?ZWBabXYYIYaYYZaVAbY?;?B?IQaOFYYXQQXQaYZaGEC5>EG?HOGZaWQYOPaGJ`G537>FG?PYYXaGYbYZ^Gb_G5CG>GG?IYYXQYYZ^YbWV?GGCE755G>?GHPbbbGGAY?7GE3555->G?OEHZZ^G7GG>55535557GGFO7G>G?GFGGGEGG355FE5GGGHF>?GGYGGE6G5+55GEE5F?GY>GGGWGE555537D5E5E6>FA>GGF?GE5GGGCE-,57E7>>>GGGGGGG7GGFCE5,,-GG?G>FGGF57G5545364,4%GG55F>GG>G7=54,-37E55,7=557GGF>>E5-55537555,7G45575?FE-4,5E73--,-E57555557E4,-54-5+\$,,/?4555575E4,55E5,,+\$,,555-E57E5E,,554>5,+,,\$,,5-55E54,,-54,55,+,,-,,,,,-454,,-5,,5,,+-5=,+,,,-454,-4,,,4+##464+,,,5-4,,,,-,\$,,###,,,,,,,55,,,,,-4,,+###,,,,,,,,4,,,,,-54,+,+#,,,,,,,,,,,,,,,,,,,+####\$,,,,,#,,,,,,,,,########,,\$,,,,,+,+##\$########\$,\$,,,,\$,,##############+,,,###\$###########,###\$,##+##########', 'Etq': "#+#,#%,,,,.,+,,,####CC\$,##\$-6<-,6,,,,,+#\$###,,+\$,,.>>->.@,,.+#\$,++\$4,,,,->>><PP,0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3\$\$,3#6K#+@PXQYXQXM##++3+#D+@C#-@QYZPPPX\$###+#-73#>##%PQYZPYPM#4###\$%>\$+\$##>PQXZPZP=3,###,6;,+##&>PZXbPPV53####,A4###,.@QaPbP>V5###+C+P\$+#\$,@PRaYaPPM##\$##C#6,,##\$@PZaZaPP;,,,#%3,+,##54@YbabaQX>;,#\$'###,##5%PYbbbaYV@\$+##=#+####3&QabbbYXPN,,,%3##\$####>QabbaZYQM,,#&K+C,++#+@Qbbb`bPN;,\$#%3####,+1PYbbbZ`P=#,#++#\$,#\$++0PZbbbZXN><,-####+###+0PbbbbbXN6,\$-%\$######+0YbbbbbX;N-3###3#+##,#(ZbbbbbX@<%#####\$#\$+,#@ZbbbbbXN,-##3#%\$###\$+@ZbbbbbP<-#%,+,5,##\$\$+@ZbbbbaP,%45,+#####,\$#(QbbbbXM##\$##35\$##+###&PZbbaP;3+,,%55##3,#+##@PYAXN#3#-+3######,%##.@N@N3+%5#&3+#+######", 'Ftq': "\$#\$54+#>#\$,#>>>;,54#,+\$+,55,&>##+&>>><-54#,#\$+,544&>###>>>>;-54#\$#,+-5-+>>\$#>>>>>;,-,#\$#,#-5-&>>'&>>>>>>\$,,#####-55#&>>>?GG>>>\$-4+,#;;-55,&?GGPGX;>;,-5+\$+&;-5MGG7GGbbH>>\$5-54#+&>'GGGGNBbbbH>>-5,54##>?POJJBR>bO2`;>%4+,+##>@JbbbBR_B_*HC>;+#,&>#>?RPP^bPbFbb`C>>##,>>;>?R]J_bPbbBb_C&>#\$3>>;>?O`bGbQRb^b_K&>;-4&>;>#O`_JPQR`RBbK&><54+>;>+Ob_`RQRbb^bG&>%55+>;;#GbGPbQX``bGG#>\$54&>;;&Hb@PRQXPPb_J#&;-+>>;#;Hb@`PQXQXbbG\$&>#>&>;;>HFR`QQYYPRb_\$#>>>>>;>#@GRPQYYYPPPPF#>>#&>;>\$(JR`PYYYYYPOGGF>;+>;;#'JbPYYYYXR`_FGGF;,&;;+>HQYYYYYPR`GJ_BHGD#;<,#PPPPYYYXR`?HRJbHOF;;4+G```YYXXR_GHRBbbGO;\$4.C``QPQP`RObHb^`RbO;-5+G@bPbQZ`bJ_GJ^R+_N#-53H_JbRaRbPJbGb^JH_K#-54HJ?`b`R`_JbG`RBR`C#-54@J_`P`XRGbRHbRBbH##,-+@Jb?bbZbJbRHb`JbG+#\$,+?R`^BbRbBR``Jb_bO#;<,#?RPbGbR^J`R`PRNbK+;<,,'RR`_B`_b__HHR_?D+;<4,/RRbb^`?GGHGHP`GD+;;55.O_bb_??GGHQXbRGE+;;-5&OGHOGFHQYYYYRbGU,#\$-5&HPOb?`PQYYXQYRG54#,54&FF'J^bbPYQXPbPK54+554>>#Hb_b``XPXRb_<54+-54&>\$HbbHbPXbP_`?<55+-95&>,O`RBR`Z`PbNH%Y5+595+&'ObbJ`QRbb_BG5Y5+-95,&'RR`_bQR`PG_G5U4#<55,<Hb`R^bPbbGb_G-53;E55+;GObb_BRb_bb_C-54;5555>'_GGbJR_BbR`C554#5555>\$8JGJ?b?`bRH<595+5554>=5YOG?FbbRRH<55U35955&=9YU6F?Gb`bR<55535955>%9YU5>8FGG_N\$55535954+=9YY5E5XGHHN\$55435YU5+=9YY355YYOJFE55-35YU5&%YYY755YYY6>=5U539YY3.=YYY75YYYY4&;9U539YU3/=9YU559YYY3>D9YY3", 'Fsp': "######,%+##\$#,&>;+#####++#######+,##>>###+#+\$+\$+#+>>#,,,+#####,#\$+###+#&>>;#\$##+###;+##+#\$+##;\$><+\$###>;+;#,#+\$\$##\$+\$&;+##&>>;,?#\$\$+L###\$#\$&V;###AV#\$)##\$+`+,#>;&>V;%##>#C+?<+,#R,##>#&AV;P#+;,O,&X#,#.L#&>;#A>&;#>>\$'#+Y##++##.>;+>>)V&>>#&#+P##++,##>;#++AW>Y>#G\$,+\$++#+######.>YAYV&S####+###,+;+>>#>IYYY>\$+;,+####\$-K#&>>>>AVAC###\$#&#&###++#>>>>>>###++###+&\$+###\$&V?V########,,+&\$+\$#(;>VIaC\$,&;;\$#,,#;+\$+#>>>>YRS#\$&;;#,,,#;+\$##>>V>YY;####;#\$#+####\$.#>YVZY>>>##\$,####,##\$+##YYZYAV>##\$,##\$+###,(&#IYaY?Y>@#P\$;####;###&&IbYV'V<Y%##>#;#;\$##M>>ZaYY?U\$A;+K&\$##>++#%NYZbYYY>#AFK###+#P((%'3YbYVAY>(YV;%####\$###78YaCW>YV&YX####\$###+%G)ZY#X&YV<IX,8\$>###%+'WYbW>S>YV<AS%##&;#\$;#7YYbWYAAY>=N8KM(&>#\$#%IYZbYX>YYY>\$0K3\$+>#%&7ZYbbYK6AYYV=#-M33A;(KIZbaYC%M&YaYG?(M33>S#7YbbaX%8L&VYYAYV4-5&S,7ZbbaC5-P8YYYYY;,53\$#P7ZbbaM8MM6YYYYY;,3K3#%GZbbYM8MM8YYYYVF%43-##9ZbaXM55M49YYYWY%,5+##OYYWPMM-8MQYYYYI\$5,##OPIWP8MP48MQYYYYA5M,PKPPMM58M55MP9YYaYA%MPPKP555P8P5P479YYbYIE55(K85,-@5P8P588YYbYZS,-8358M5585P8585XYbaYE5P5355P4-P858L84MIbbaD8M53-5M-5P88O5MM8YbbaU-M5+55P58PMPO4PL7ZbbaU8M534-5M58P588HHOZZbbX55,34-4858PM58PP8ZbbbY45,3,588M8M8M5855YbbbW854+,L8547E548PP49ZbbW844+%458M8MM48MP4/YbbY%45#58M8M#8PP8485PYYYX5P5#%-5-P(8OP=555OQYYC-5-KP5-8N8PPMN855PPOPP5-8K(858>M558NE8H558PP588#", 'Tev': "\$44,+##%%>HIPK>\$&#/C##\$-4,,##\$->HXPJ>+>#%K##;,-,,#%\$+>PHP&B2B3\$D##>,,,,#55-^OPE6<&;#G+#+&<,,,-#5+`OO#>[^['L#%3&;4-+,5%+`HR3>;b3/C#,+/&\$,,,55-PPb4b[]37+%4+HF<,4\$557OO]5b:]37+/D+#DB45,54PHR]5b2559OL/[;G&],-7PIPb^-]^55\$G+0;>72;5,POXObb4Db555,3_C#YG^]0QYPJ]b0P]55]42>C,,72]8QHP:]_YH]555,^=C\$*?L:7QP-:]QQO555-bBO#[,/_G]QH5:_HQR555:^GD3B]2]7EGHM5HPIL555bbW4+B^<:]-0HK\\OMIO:55bbD,3B^B*b58OP0X-QH55:b]HE3>>^=558QHQP5GXE5:b%4GC^>bb]:\\PXWL58XM]5]55_Cbbb^b55PIXE57QO55b5:'[:bb^b55/OX-54QP-5::b`C55:b]5558P555PXM5:bbbC55555]555E5550WL5:]b5+]:555]]:555558QP5:]55+bbb555:5554O54OXM5:bb[^b]:5555557PM58WL55bb[>bbb:]5:554QPG-GP-5bb[bbb5:b5:557QGPPHHM:]b3,-]5555:558YPLPHHM55535555555555HXE57GG555535]:555:554QG55555555-+535]55]558WM55555:]b53,5555]555QH55555555b:[-55b]5550IL555555bb5:[5:b^]550QXM55555:^bb##5bb:]5HOYP5555555bbbb3^B55-:PQYO55555555bbB[b]4:D57HOXR54PE555bb>[]30'Z55:GPP5GWM5555bb[43D`2%:55HOPGIL5545':[4%GG`L:55:HPGQP5594W-[51FGGW]55:5+5/XE51GI-+_W>X-/555b]b58XR5Y*'D+?F[G:\\L55_P#,4QP5L55D3>J\\+^bG55`GHPPQH-C530+=J,,^]7-5_WOYYYHO%#-9+=\$,2B\\5,5_GPOGPPO4-HG+7\$,&>45W:bIM0PMbF\\O,##S,+>B57T6bGO5:5:><G###,,&>\\5,M6B\\O5-3:>ID###,+^>\$%+'>B_PC4%-;HE+##,+>B-%+\$>B6GO\$-%;WB+##,&><+\$55>B.@O--#;G>43#+>>%+\$5:>>&_P,-#&G><3##>>,#4#*>B&=P,+%'K>;,#&>;,#-#6>B.\\,5+#\$F>>\$3", 'Tvf': "\$,,6'F7\$'3>E4,=,'HD,,+\$,T5%:</-_FK,G-<'O\$T,#\$,12]:?GGE;'<>-</<T+T+?',2_\$'FD\$D2]7F4/D,,,+-1,-4\$+=4/,?6=/4\$/,,D+WIG/[/G55///]-/61,/DI+T<G/6/E7=DG/]:'5,GG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5Y\$565MGG5?7)D5587GE55G)\$65LG7=7E3Y#5<.EGEE=CY\$587FGE=?C)\$5MG6ECGGGY%:/E=GCWG)Y%07F5GGYGYY\$M?67GG)Y#Y(575G7CYYYY0=G5GG'#YYY,=G57YC#YYY\$7G=GY)SYYY\$5GG#SYSYYY#C))Y)YYYYY#C))Y)YYYYY"}

Noms={'Vsi':"Vent", 'Vtq':"Attaque de Vent", 'Vsp':"Change", 'Esi':"Eau", 'Etq':"Attaque d'Eau", 'Esp':"Prisme", 'Fsi':"Feu", 'Ftq':"Attaque de Feu", 'Fsp':"Double", 'Tev':"Volt", 'Tvf':"Terre", 'Tfe':"Glace", 'Lum':"Lumière", 'Obs':"Obscurité"}

Images=sorted(tuple(Noms.keys()))

# règles en français
Regles=("Joue une carte avec le même\n élément que la carte en jeu.\n\n La couleur des bordures est\n différente pour chaque\n élément.",\
"Si la carte en jeu est Feu,\n combat Feu avec Feu.\n\n Tu peux aussi utiliser\n Double et Glace.",\
"Si la carte en jeu est Eau,\n combat Eau avec Eau.\n\n Tu peux aussi utiliser\n Prisme et Volt.",\
"Si la carte en jeu est Vent,\n combat Vent avec Vent.\n\n Tu peux aussi utiliser\n Change et Terre.",\
"Des cartes du même élément ne\n sont pas toujours nécessaires.\n\n Il y a aussi Lumière\n et Obscurité.",\
"Enchaîne les tours en jouant\n des cartes.\n\n Le premier qui utilise toutes\n ses cartes gagne.",\
"Si le joueur précédent joue\n une carte d'attaque, alors tu\n dois piocher 2 cartes en plus.\n\n Oh, mais attends !\n\n Utilise ta carte d'attaque si\n tu en as une, pour transmettre\n l'attaque au joueur suivant.",\
"Tu peux passer ton tour avec\n shift au lieu de jouer.\n\n Tu dois piocher une carte\n lorsque tu passes ton tour.",\
"Tu peux tenir au maximum 15\n cartes.\n\n Si tu passes ton tour\n avec 15 cartes en main,\n alors tu perds la manche.\n\n Fais attention !",\
"Pour les règles de chaque\n carte, choisis Cartes.\n\n\n On joue ?")

pos=-1
while pos != 2:
fill_rect(0,0,320,222,"w")
draw_string("WHIS",140,30,"purple")
draw_string("Cartes    Règles    Jeu :)",30,80,"b")
for i in range(5):
IMG(Images[3*i],18+60*i,130)
#fill_rect(50+100*i,50,20,20,"rbg"[i])
chg=1
while not keydown(KEY_EXE):
if chg:
for j in (1,0):
for k in (0,1):
draw_string("[]"[k],15+80*k+100*pos,80,"rw"[j])
#draw_string("]",100+100*pos-10*(pos==2),80,"w")
pos=(pos+chg*j)%3
#for k in (0,1):
#  draw_string("[]"[k],15+80*k+100*pos,80,"r")
#draw_string("]",100+100*pos,80,"r")
sleep(0.2)
chg=keydown(KEY_RIGHT)-keydown(KEY_LEFT)
while keydown(KEY_EXE):1
fill_rect(0,0,320,222,"w")

# pos = 0 : cartes    pos = 1 : règles    pos = 2 : jouer

if pos==0:
p=11
chg=1
while not keydown(KEY_EXE):
if chg:
p=(p+chg)%14
draw_string(Noms[Images[p]]+" "*20,20,60,couleurs(Images[p])[3])
draw_string("Utilise cette carte\n        "+("si la carte en jeu \n        est "+("Eau. ","Feu. ","Vent.")[("f" in Images[p][:2].lower())+2*("v" in Images[p][:2].lower())],"avec n'importe quel\n        élément.")[Images[p] in ("Lum","Obs")]+"\n        "+(""," "*25+"\n"+" "*33)[Images[p][2]=="i"]+("","Change "+("Eau","Feu","Vent")[(Images[p][1]=="f")+2*(Images[p][1]=="v")]+" en "+("Eau. ","Feu. ","Vent.")[(Images[p][2]=="f")+2*(Images[p][2]=="v")]+"   \n"+" "*33)[Images[p][0]=="T"]+"Le joueur suivant     \n        doit piocher 2 cartes."*(Images[p][2]=="q")+"Change la carte en jeu\n        en l'élément choisi.  "*(Images[p] in ("Lum","Obs","Esp"))+"Donne un tour         \n        supplémentaire.        "*(Images[p]=="Fsp")+"L'ordre de jeu est    \n        inversé.              "*(Images[p]=="Vsp"),80,80,"purple")
IMG(Images[p],20,85)
sleep(0.2)
chg=keydown(KEY_RIGHT)-keydown(KEY_LEFT)
while keydown(KEY_EXE):1

if pos==1:
p=-1
chg=1
while not keydown(KEY_EXE):
if chg:
p=(p+chg)%10
fill_rect(0,0,320,222,"w")
if p in (1,2,3):
Liste=("Fsi","Ftq","Fsp","Tfe","Esi","Etq","Esp","Tev","Vsi","Vtq","Vsp","Tvf")[4*p-4:4*p] #(("Fsi","Ftq","Fsp","Tfe"),("Esi","Etq","Esp","Tev"),("Vsi","Vtq","Vsp","Tvf"))[p-1]
for i in (0,1,2,3):
IMG(Liste[i],30+70*i,30)
Nom=Noms[Liste[i]].split(" ")[0]
draw_string(Nom,51+70*i-5*len(Nom),95,"rbg"[p-1])
if p==4:
for k in (0,1):
C=("Lum","Obs")[k]
IMG(C,80+110*k,30)
draw_string(Noms[C],67+100*k,95,couleurs(C)[3])
if p==7:
IMG("Pio",140,140)
draw_string(Regles[p],10,40+80*(0<p<5),"purple")
sleep(0.2)
chg=keydown(KEY_RIGHT)-keydown(KEY_LEFT)
while keydown(KEY_EXE):1

scores=[0,0,0,0]
jr=randint(0,3)
#rejouer=False
for manche in range(5):

# constitution du deck de cartes, nombres à ajuster

Jeu=["Fsi","Vsi","Esi"]*4+["Fsp","Vsp","Esp"]*3+["Ftq","Vtq","Etq"]*2+["Tfe","Tvf","Tev"]*3+["Lum","Obs"]*3

# mélange/brassage du deck

for i in range(100):
Jeu.append(Jeu.pop(randint(0,(len(Jeu)-1))))

# composition des mains

Mains=[[],[],[],[]]
for i in (0,1,2,3):
for j in range(6):
Mains[i].append(Jeu.pop(0))
Mains[i].sort()

# préparation du plateau

sens=1
#jr=(jr-sens*(1-rejouer))%4
clr_choisie=""
nb_atq=0
Perdant=-1

# le joueur est le numéro 0 et sa main est Mains[0]
fill_rect(0,0,320,222,"w")
IMG("Pio",172,60) # icône de la pioche
IMG(Jeu[-1],114,65)#Aff_carte()

for n in (0,1,2,3):
actu_jr(n)
#Aff_plateau()

while not (min(len(Mains[i]) for i in (0,1,2,3))==0 and nb_atq==0) and Perdant==-1: # tant qu'aucun joueur n'a gagné
rejouer=False

if Jeu[-1] in ("Esp","Lum","Obs"):
clr_atd=clr_choisie
elif Jeu[-1][0] in "EFV":
clr_atd=Jeu[-1][0].lower()
else: # carte de transition
clr_atd=Jeu[-1][2]

actu_jr(jr,(210,100,255))#Aff_Plateau()
sleep(0.5)

tour_fini=False
deja_pioche=False
if not cp_ok(jr): # si on ne peut pas jouer, alors on pioche, ensuite si on peut joueur, on joue sinon le tour est fini
#sleep(0.5)
pioche(jr)

if jr==0:      #il va falloir choisir la carte à jouer
p=0
chg=1

while not tour_fini and cp_ok(jr):
L=len(Mains[jr])
D=min(50,251//max(1,L-1))
if chg:
for k in (1,0):
fill_rect(10+D*p,200-63*k,47,10,"w")
IMG(Mains[0][p],12+D*p,140+10*k)
p=(p+chg*k)%L
sleep(0.2)
chg=keydown(KEY_RIGHT)-keydown(KEY_LEFT)
if keydown(KEY_SHIFT):
if not deja_pioche:
pioche(jr)
chg=1
else:
tour_fini=True
if keydown(KEY_EXE):
if condition(p,1) or condition(p,2) or condition(p,3):
traitement(p)
#fill_rect(0,125,320,97,"w") #on efface les cartes de Joueur 0
elif cp_ok(jr) and not tour_fini: # C'est un autre joueur qui joue
for m in (1,2,3):
for i in range(len(Mains[jr])):
if condition(i,m) and not tour_fini:
traitement(i)
break
sleep(0.5)
#Aff_Plateau()
#sleep(1)
actu_jr(jr)
jr=(jr+sens*(1-rejouer))%4
#calcul des scores :
fill_rect(0,0,320,222,"w")
draw_string("Fin de la manche "+str(manche+1)+" sur 5\n\n             manche     total",40,40,"purple")
score_manche=tuple(sum(2+18*(carte[0] in "LO")+3*(carte[2]=="p")+8*(carte[2]=="q") for carte in Mains[j]) for j in (0,1,2,3))
#if Perdant==-1:
#  scores[Mains.index([])]+=sum(score_manche)#*(Perdant==-1)
for j in (0,1,2,3):
#scores[jr]-=score_manche[jr]*(Perdant==-1)
Sco=(((1-4*(Perdant==j))*(score_manche[Perdant]//3),-score_manche[j])[Perdant==-1],sum(score_manche))[Mains[j]==[] and Perdant==-1]
scores[j]+=Sco
draw_string("Joueur {} : {:>+4d} pts {:>+5d} pts".format(j+1,Sco,scores[j]),10,95+20*j,"b")
jr=(Perdant,(jr,j)[Mains[j]==[]])[Perdant==-1]
sleep(7)
#sleep(2)

#draw_string("         Partie terminée \nScores : ",40,40,"purple")
#for k in (0,1,2,3):
#  draw_string("jr "+str(k+1)+" : "+str(scores[k])+" points",60,100+20*k,(("purple","r")[scores[k]==min(scores)],"g")[scores[k]==max(scores)])

#for carte in Images:
#  IMG(carte,5+50*(Images.index(carte)%5),10+65*(Images.index(carte)//5))
```