B
Anonyme

Salut j’ai la flemme de quitter foforum alors je viens perdre mon argent ici petit voleur.
Python:
from math import*
from kandinsky import*
from ion import* #pour detecter l´interaction de l´utilisateur avec les touches
#init
x=0
y=0
d=10 #un decalage pour pouvoir faire defiler le texte quand il sort de l´ecran
t=1 #pour la taille
grille=[]
mot=input("mot: ")
while len(mot)>8 or len(mot)=0:
print("Votre mot est trop long ou trop court (max 8, min 1)")
mot=input("mot: ")
draw_sting(mot,0,0)
#"scan" du texte
for i in range(200*len(mot)):
grille.append(get_pixel(x,y))
x+=1
if x==10*len(mot)+1:
x=0
y+=1
#affichage
def draw():
fill_rect(0,0,320,222,"white")
x=d
y=10
for i in range(200*len(mot)):
fill_rect(x,y,t,t,color(grille[i]))
x+=t
if x==(10*t)*len(mot)+d+t:
x=d
y+=t
draw()
while True:
if keydown(KEY_UP):
t+=1
draw()
if keydown(KEY_DOWN) and t>1:
t-=1
draw()
if keydown(KEY_LEFT) and d>((10*len(mot)*t)-310)*-1:
d-=t*3
draw()
if keydown(KEY_RIGHT) and d<10:
d+=t*3
draw()
Dans ce code python comment je pourrais optimiser plus la mémoire vive ?
Sans non plus changer l’intégralité du code.
Ah et au cas où j’ai fait ce code sur une calculatrice lycée NUMWORKS.
Merci d’avance et donne moi des fofocoins aussi