Petit script pour réviser ses figures de styles
from random import *;from kandinsky import *;from ion import *;from time import * ds,kd,fr,sl,p=draw_string,keydown,fill_rect,sleep,print a={"ALLEGORIE":" Personnification d'une ide"+chr(769)+"e abstraite ","ALLITERATION":" Re"+chr(769)+"pe"+chr(769)+"tition d'une ou de plusieurs consonnes dans un groupe de mots","ANAPHORE":" Re"+chr(769)+"pe"+chr(769)+"tition d'une me"+chr(770)+"me expression ou d'un me"+chr(770)+"me mot en de"+chr(769)+"but de phrase ou de vers","ANTITHESE":" 2 termes de sens oppose"+chr(769)+"s dans une me"+chr(770)+"me phrase","ASSONANCE":" Re"+chr(769)+"pe"+chr(769)+"tition d’une me"+chr(770)+"me voyelle dans un groupe de mots","CHIASME":" Structure en croix qui associe 2 termes sans ne"+chr(769)+"cessairement qu'ils aient un rapport de sens","COMPARAISON":" Etablir un paralle"+chr(768)+"le entre un compare"+chr(769)+" et un comparant a"+chr(768)+" l'aide d'un mot-outil","ENUMERATION / ACCUMULATION":" Juxtaposition d'une se"+chr(769)+"rie de termes","EUPHEMISME":" Formulation adoucie d'une ide"+chr(769)+"e qui pourrait paraître trop brutale","GRADATION":" Succession de mots/expressions de sens voisins et dont l'ordre traduit une progression","HYPERBOLE":" Exage"+chr(769)+"ration dans le choix des mots","IRONIE":" Dire le contraire de ce que l'on pense","LITOTE":" Utilisation d'une expression sugge"+chr(769)+"rant beaucoup plus que ce qu'elle dit re"+chr(769)+"ellement","METAPHORE":" Etablir une assimilation entre un compare"+chr(769)+" et un comparant sans outils de comparaison.","METONYMIE":"Remplacer un e"+chr(769)+"le"+chr(769)+"ment par un autre e"+chr(769)+"le"+chr(769)+"ment appartenant au me"+chr(770)+"me ensemble logique","OXYMORE":" Re"+chr(769)+"unir a"+chr(768)+" l'inte"+chr(769)+"rieur d'une me"+chr(770)+"me expression deux mots aux sens oppose"+chr(769)+"s","PERIPHRASE":" Remplacer un terme par une expression qui le de"+chr(769)+"finit","PERSONNIFICATION":" Attribuer des qualite"+chr(769)+"s humaines a"+chr(768)+" un objet inanime"+chr(769)+"","PLEONASME":" Re"+chr(769)+"pe"+chr(769)+"tition superflue de termes","SYNECDOQUE":"Remplacer un mot par un autre ayant une relation d’inclusion.Cas particulier de la me"+chr(769)+"tonymie."} wai1_c=[[255, 255, 255], [236, 227, 228], [225, 216, 219], [187, 178, 184], [124, 118, 125], [93, 89, 97], [209, 199, 204], [155, 148, 158], [62, 60, 64], [235, 210, 186], [250, 230, 204], [253, 245, 217], [184, 141, 122], [46, 43, 47], [224, 168, 139], [117, 91, 39]] wai1="A516B3CB3A72B10A69B3DEF2EDB3A67BCGEFEH2EFEHCBA65BCGFHCB4CHFHCBA64BGEDB7DI2HDA63B2HGCB8GDIFDA61B2CGCB2C2B5CBDFCA61BG2BC2BJCBCB4CBDBA61GC2BGBGKCBDCB3CBCBA60BGC2BGCGLJCDGBCBCBC2A60BC3BD2L2CGDJCGBGBCB2A58B2C2GBD2L2KD2JGDCGBCB2A58BABCGCHJKL2HDLJHGDCGCBA58BABG3ML4D2L2JD2CG2BA58BABCG2ME2JLKDKJE2DCGC2A60BCGDHNFML2KJFNHDG2CB2A59C2GDCEFCL3KDFEBGJB2A60GBCDKGMKL4BDGKGB3A58BACG2DKJ2KL4KJ3G2B2A58BABGEDJ3KLKL2KJ3GHCB2A57B3CEHJK3L4K3JDHGBCA57B2CGEHGL9KD2HGB3A55B2DCGH3JL3K2L3D2GD2B4A53B2CHBGH4DL5KDFHDGHG2B3A51B3D2BCHDH2FOKL2KHDEHGCHD2CB3A49B3CHGB2DCH2FO2J2OEGEGC2HD2HB2CA49B3DHGBCGBGHFMO4FDHCBGHGDHDBGBA48GCGH2CBDGBGFIJ2O3HIHCBDHGH3CDBA48GH4B2DC2HINGBJ2CEN2DBGEGDH2DHBA49DHEDBGDCGFI2GAJBCI3ECGHDH5BA49CHEGHFDCDI3DGIDBI4G2DH2EH2DA47BA2GCHFIEHGHNI2HGNHGI3NHGDI2EHDHBA46B2AB2HI2EHDEINIHBNCGI2NIFGHEI2HACGA45B2CABCDI2E2HFI3HCIG2I5DEFI2DA2GA45B2GB3DI2FE2I4FDIH2I5DFI3HA2GABA44B5DINI2EI5HIE2I5EINIFDCBCACA45BDGCEI2NI20FC3B3A45G2BD2I12NI7NI2EDGCBCA46GBC2DI12NI10EBGHDA46CB2CBEI8NI5NI8EB2G2A46B3CGFI11NI11ECB2DA46B3CDEI9NININI9EDB4A2BA42GB2GDHI8N6I6NI2EHGB5A42CHCBDH2I2N2I4N8I3N2I2EH2CBC3A41CGA2CGH2I2N8PIN9I2FDH2C2D2A40BGA3CGH2I2N19I3HDHDC2HBA39BCA3CGH2FIN19I3HGH2GBDBA39BCAB2DGDHI2N8PN10I3HCH2DCGB" def gm_r():fr(0,0,320,225,(80,80,80)) def i(im,pal,t=4,po=0,py=0,suppr="",bs=80): r,i=0,0 while r<len(im): s,n=im[r],'';r+=1 while r<len(im)and'9'>=im[r]>='0':n+=im[r];r+=1 nb=1 if n==''else int(n);c=pal[ord(s)-65] for j in range(nb): if str(s)!=str(suppr):fill_rect(po+t*(i%bs),py+t*(i//bs),t,t,(c[0],c[1],c[2])) i+=1 def gm_tp(txt,ma=32,st=""): a,b,A,d=list(txt)+[''],'','\n'+st,[" ","\'",",","."];l=len(a) if l>ma: mb=int(ma) for j in range(l//ma): nl=1 for i in range(1,ma//4): if d.count(a[mb-i])>=1:a[mb-i]=A;mb+=mb-i;nl=0;break if nl:a.insert(mb,A);mb+=mb for i in range(l):b+=a[i] else:b=str(txt) return b,l//ma def gm_w(txt,perso): A='\n' a,b=list(txt)+[''],'';l=len(a) if l>64:p('#>64') if l>32: for i in range(64-l): if a[32-i]==' ':a.insert(33-i,A);break if a.count(A)<=0:a.insert(32,A) for i in range(l):b+=a[i] else:b=str(txt) ds(str(perso),0,160,"1",(80,80,80));ds(str(b),0,180,"1",(80,80,80)) def gm_a(a,b,c,d,e,a5='#err:str?'): ds('[up]'+str(a),0,0,"1",(80,80,80)) if e>=2:ds('[down]'+str(b),0,18,"1",(80,80,80)) if e>=3:ds('[left]'+str(c),0,36,"1",(80,80,80)) if e>=4:ds('[right]'+str(d),0,54,"1",(80,80,80)) if e>=5:ds('[ok]'+str(a5),0,72,"1",(80,80,80)) def gm_c(a,b,c,d,e,a5=0): while True: if kd(1)and e>=1:return a if kd(2)and e>=2:return b if kd(0)and e>=3:return c if kd(3)and e>=4:return d if kd(4)and e>=5:return a5 def pu(a,x=53,y=75,w=205,h=75):fr(x,y,w,h,(0,0,0));fr(x+1,y+1,w-2,h-2,"1");ds(a,x+2,y+2);ds('[ok]',x+2,y+h-20);gm_c(1,1,1,1,5,1) def f_r(): l=[] d=len(l) while d<3: b=choice(list(a.keys())) if b not in l and b!=des_k: l.append(b) d=len(l) l.insert(randint(0,3),des_k) return l s=0 gm_r() i(wai1,wai1_c,4,0,0,"A") gm_w("Pre"+chr(769)+"pare toi, tu devras lier lesfigures de styles et de"+chr(769)+"finitions","Makikemi") sl(0.5);gm_c(1,1,1,1,5,1);gm_r() while not keydown(5): des_k=choice(list(a.keys())) des=a[des_k] f=f_r() gm_r() print(des_k) ds(gm_tp(des)[0],0,100,"1",(80,80,80)) ds(str(s),280,0,"1",(80,80,80)) gm_a(f[0],f[1],f[2],f[3],4) if gm_c(f[0],f[1],f[2],f[3],4)==des_k: s+=1 if s%5==0:gm_r();i(wai1,wai1_c,4,0,0,"A");gm_w(choice(("Continue comme ça","c'est bien","Oui","Super","Ge"+chr(769)+"nial","Sensationnel","Extraordinaire","Bien joue"+chr(769)+"")),"");sl(0.5);gm_c(1,1,1,1,5,1) else:pu("C'e"+chr(769)+"tait "+des_k);sl(0.5);gm_c(1,1,1,1,5,1);gm_r();i(wai1,wai1_c,4,0,0,"A");gm_w(choice(("Pas grave","Tu feras mieux la prochaine fois","Garde courage")),"");sl(0.5);gm_c(1,1,1,1,5,1);gm_r();s=0 sl(0.2)