partager Voir la version commentée
Test de création d’un nouveau type d’interface avec le moteur graphique GeMa
Ce fichier nécessite l’installation de :
try:from gemamin import *;from dataia import * except:print('GeMa MIN et dataia sont requis') pal=[[255,255,255],[178,176,179],[163,135,135],[148,143,149],[123,113,119],[216,208,209],[237,230,228],[95,86,92],[66,60,66],[37,36,40],[153,107,103],[189,125,124],[207,166,162],[243,204,187],[166,79,80],[170,43,50]];im='A5B2C3DED3E2DFA67BDE2D4E4DBA67B4D3E2DE3DGA65BD5E8DGA64GE14DA9GFB5F2B4F2GA40GE4HE9DA5GBEHI12JI2HDFA12GBD3F2A19GEH2IE10FA2FDI6H2I13HEBGA7FDE3H2EFA20GEI2E10DGDI5H5E2I5H6I3HBA4GDE7BA22GEHE5H2E4I4H2IHE2HIHE2H5I2H8DG2BEHE6BA24GEH7E2HI3H2IHEDEI2E3H2E4H2IH5E5I4H3EFA27BEH5EHI3H3ED2EIHE3HE6HE2H2EH4I2J2I3HEBGA30GB4HI3H3ED3IHD2E2HE7HE2H2E3HJ4I2EBGA36FHI2H2ED4HED3EHE6D2H2E2H2E3HJ3IFA39DIHEHDBFD2E2D4HEDED2ED3EHE3HE5I3DA38FHIEHEDBF2DEFBDBE2D8BE2DB2EDFED2IJI2BA37DIHEH2ED2BEDFBGBHBFDBFD2BFGD2EFBEHBD2EHIJIEGA35FHIEIH3E2DHD2F2DHFGDF2DEF3D2HB2H2E5IJIHBA35BIE2H4E2H2E2B2HDBDEBDE2D3EDID2IH2EHEH2I3EA35DIEH5E2IEHECEHECED4E5DIE2I2HEH2EHI2JEFA33GEIDHE6IEIDCEKECEDED2E4HEKE2I2H4E2I2JIDA33FEHEHE6HEIC2K2C2ECE7HCLE2I2H2EHE2HI2JEFA32BHEIE6HEH2CDK2C2E2C2E3CEHKLE2I2H4EH2IH3DA32BHEIEHE3DIEHKC2L2C2E2C3EC2EHLME2IKH2EH4IEDBHA32BHEJE6IEK2C2N2LCE2C3EMCECN2CHK2H2EHE2HIEDGHFA31BEDI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ML2MOFG7NL2CBF5EJ4HD2IJ4IJDA2GEBG4FCIFBFHD2FA12EMO2PM3OM2OML2FG8MKBGFG2F2IJ4HFBHJ5IJFA2DBAG2F2BIB2ABED2A12IL3MLFM3FM2L2G9MDF2G4BIJ2I2EG2DIJ5EA3B2AG2F2BIDBAGEDEA12HOM5PM3PM2PG9BF2G5FDJI2DB2FBIJ5EA3B2G3F2DH2FA2D2HGA11HPO2LPLO2LMPO2PG8FBFG7FEIDGF2G2HI2HJ2DGA2FBG2F3H2DA3BE2FA11HP3MPLFOFMLM2PG7FBFG7FGFBFAFBG2DIBFDEGA3FBG2F2BIHBA3GE2FA11HP3MPM3FGLMOPG7BEFG7FG6DF2B2F2BFGA2GB2GF3DIHFA3GEHGA11IP3MPFLM2PMOMPG4AG2BEBG14DF4GF2G2A2FDBF4HI2FA3FH2A12HP2OFMFLM2LMLMPG7BD2FG12FDFBFG6AGBDF4BI3GA3FHEA12HOPM2OPMPL2PM2OG7FD2FG5FG6FBFDG7AFB2F4EI2HA4DIBA12HI2CF4G5BFG8FDBFG4FG7FCBG5FG2B3F3BI3HA3GI2' def simmot(tin,md=0): mots,mo,m=[],[],"" for i in range(len(tin)): if str(tin[i])==" " or str(tin[i])=="," or str(tin[i])=="'" or str(tin[i])=="\'" or str(tin[i])=="&" or str(tin[i])=="?": mots.append(str(m));m="" else:m=str(m)+str(tin[i]) mots.append(str(m)) for i in range(len(mots)): if no.count(mots[i])==0:mo.append(mots[i]) if cfg[5]=="1":p("|Mots detectes(+chance utilisation m[0])\n|"+str(mo)) if md=="learn":return rch([rch(mo),mo[0]]) else:return mo #else:return mo[0] def learn(np,do=0): gm_w(rch(["Que doit je repondre ?","quelle reponse voulez vous ?"]),cfg[1]) sl(2) nr=str(i("Reponse :")) if nr=="":ho("Ecris un peu ?") if nr.count("'")>0 or nr.count("\'")>0:ho("Je ne peux pas apprendre ca") data.append(np);datar.append(nr) if do==1 and tuple(np).count(" "): data.append(simmot(np,"learn"));datar.append(nr) if cfg[5]=="1":p("|data - double ajout") with open("dataia.py","w") as dt: dt.write("#data="+str(data)+"\ndatar="+str(datar)+"\nerr3="+str(err3)+"\nno="+str(no)+"\ncfg="+str(cfg)+"\n");dt.close() if cfg[5]=="1":p("|texte insere dans data") ho(rch(["c'est enregistre","ok","je comprends","c'est note"]),1) def tr(txt): try: if cfg[4]=="1": try:ho(str(datar[data.index(txt)]),1,txt) except: mo=simmot(txt) for i in range(len(mo)): if data.count(mo[i])>0:ho(str(datar[data.index(mo[i])]),1,txt) p(datar[data.index(mo[i])]) else:ho(str(datar[data.index(txt)]),1,txt) except: try: if cfg[2]=="learning" and cfg[4]=="1":learn(txt,1) elif cfg[2]=="learning":learn(txt) elif cfg[2]=="userep":ho(str(data[datar.index(txt)])) elif cfg[2]=="websearch":p(cfg[1]+"Resultats sur le web\nhttps://discode.fr/s?r="+str(txt)) else:ho(rch([err3,"Je ne comprends pas","Ce n'est pas dans mes donnees","pas de resultats"]),1) except:gm_w("","err") bcl=0 def ho(a=rch(("Que voulez vous me dire ?","Que voulez vous me raconter ?")),b=0,d1o=""): global bcl if ra(0,15)>14:a=rch(datar) gm_t(a,cfg[1],im,pal) if b!=0 and cfg[2]=="learning":gm_a(rch(("Continuer","Suivant")),"modifier",0,0,2);bcl=gm_c(1,2,0,0,5,1) elif b!=0:gm_a(rch(("Continuer","Suivant")),0,0,0,1);bcl=gm_c(1,0,0,0,5,1) if bcl==2: nr=i(d1o+"\n") if nr.count("'")>0 or nr.count("\'")>0:ho("Je ne peux pas apprendre ca",1) datar[data.index(d1o)],b=nr,1 with open("dataia.py","w") as dt: dt.write("#data="+str(data)+"\ndatar="+str(datar)+"\nerr3="+str(err3)+"\nno="+str(no)+"\ncfg="+str(cfg)+"\n");dt.close() if b!=0:ho() gm_a("Input",0,0,0,1);gm_c(1,0,0,0,5,1);i1=i("\n"*10+"/\\"*20+"\n").lower() if i1=="":ho("Reponds moi, ne reste pas silencieux >_<",1) tr(i1) try:pu("v0.15 - Ce programme peut presenter des bugs");ho() except:gm_err()