Page 1 of 2

[83PCE] Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 18:04
by Anonyme0
Bonjour,

Je m'ennuyais alors j'étais en train de modifier ce snake (archives_voir.php?id=179865), et à un moment je voulais que le fond du graph change en fonction du score (couleur random). Alors j'ai essayé de changer le fond avec ArrPlanAff . Et au lieu de changer le fond, ça laissait une traînée au snake de la couleur choisie. L'affichage est très rapide, je n'ai pas encore cherché pour isoler le bug mais je mets à disposition le programme en pièce jointe.
Voici un screen de ce que ça me fait (ça affiche les carrés rouges derrière le snake)
Image
Vous pouvez tester le programme (en pièce jointe), lancez le snake, mangez une pomme et admirez (le snake n'est pas fonctionnel j'ai supprimé les collisions du snake) !

Si on peut l'exploiter ce serait franchement bien parce que l'affichage est extrêmement rapide !

Re: 83PCE Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 18:47
by critor
Sur ta capture d'écran, le fond a été réglé à quelle couleur ?

Sinon très joli - n'hésite pas à publier ton amélioration. :)

Re: 83PCE Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 18:52
by Anonyme0
Au début du programme le fond a été réglé sur noir, et quand le score arrive à 10 je le met en rouge, et ça produit ce bug.

Re: 83PCE Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 18:55
by critor
Il faudrait voir quelles sont les instructions graphiques utilisées.

Re: 83PCE Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 18:58
by Adriweb
critor wrote:Il faudrait voir quelles sont les instructions graphiques utilisées.


Code: Select all
BackgroundOn BLACK
Lbl 9
Menu("SNAKE","Nouveau jeu",3,"Quitter",0
Lbl 3
AxesOff
ClrDraw
0→Xmin
0→Ymin
1→ΔX
164→Ymax
DelVar S
TextColor(BROWN
Text(0,112,"SNAKE
TextColor(BROWN
Text(20,100,"Score: 0
Line(33,27,228,27,WHITE
Line(33,27,33,126,WHITE
Line(33,126,228,126,WHITE
Line(228,126,228,27,WHITE
{6.11,6.12,6.09,6.1→L₁
Pt-On(103,72,2,WHITE
Pt-On(111,72,2,WHITE
Pt-On(119,72,2,WHITE
Pt-On(127,72,2,WHITE
2→T
1→D
6→A
12→B
DelVar IDelVar J
Repeat not(pxl-Test(142-8I,33+8J
randInt(1,12→I
randInt(1,24→J
End
Pt-On(31+8J,24+8I,3,RED
Lbl 1
getKey→K
If K≥24 and K≤26=34=105
Then
If K=105:Pause
If K=24 and D≠1:3→D
If K=25 and D≠4:2→D
If K=26 and D≠3:1→D
If K=34 and D≠2:4→D
End
If D=1:B+1→B
If D=2:A+1→A
If D=3:B-1→B
If D=4:A-1→A
If not(A:12→A
If A=13:1→A
If not(B:24→B
If B=25:1→B
If pxl-Test(143-8A,32+8B
Goto 2
Pt-On(31+8B,24+8A,2,WHITE
T+1→T
If T>dim(L₁:1→T
If pxl-Test(140-8A,31+8B
Then
dim(L₁→C
L₁(C→L₁(C+1
–1→L₁(C
Repeat not(pxl-Test(142-8I,33+8J
randInt(1,24→J
randInt(1,12→I
S+10→S
If S=10:BackgroundOn RED
If S=20:BackgroundOn GRAY
If S=30:BackgroundOn BLACK
End
TextColor(BLUE
Text(20,146,S
Pt-On(31+8J,24+8I,3,LTGRAY
End
Pt-Off(31+800fPart(L₁(T)),24+8int(L₁(T
Pt-Off(31+800fPart(L₁(T)),24+8int(L₁(T)),2
A+B/100→L₁(T
Goto 1
Lbl 2
ClrHome
Output(1,1,"GAME OVER
Output(2,1,"SCORE:
Output(2,10,S
Pause
Goto 9
Lbl 0
AxesOff
ClrDraw
ClrHome

Re: 83PCE Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 18:59
by Anonyme0
Je n'ai pas encore potassé la-dessus, mais voici le code (commenté)(sans les collisions) :
Code: Select all
ArrPlanAff NOIR   // Fond noir
Lbl 9
Menu("SNAKE","Nouveau jeu",3,"Quitter",0
Lbl 3
AxesNAff
EffDess
0→Xmin
0→Ymin
1→X
164→Ymax
DelVar S
CouleurTexte(MARRON
Texte(0,112,"SNAKE
CouleurTexte(MARRON
Texte(20,100,"Score: 0
Ligne(33,27,228,27,BLANC
Ligne(33,27,33,126,BLANC
Ligne(33,126,228,126,BLANC
Ligne(228,126,228,27,BLANC
{6.11,6.12,6.09,6.1→L₁
Pt-Aff(103,72,2,BLANC
Pt-Aff(111,72,2,BLANC
Pt-Aff(119,72,2,BLANC
Pt-Aff(127,72,2,BLANC
2→T
1→D
6→A
12→B
DelVar IDelVar J
Repeat non(pxl-Test(142-8I,33+8J
nbrAléatEnt(1,12→I
nbrAléatEnt(1,24→J
End
Pt-Aff(31+8J,24+8I,3,ROUGE
Lbl 1
getKey→K
If K≥24 et K≤26 ou K=34 ou K=105
Then
If K=105:Pause
If K=24 et D≠1:3→D
If K=25 et D≠4:2→D
If K=26 et D≠3:1→D
If K=34 et D≠2:4→D
End
If D=1:B+1→B
If D=2:A+1→A
If D=3:B-1→B
If D=4:A-1→A
If non(A:12→A
If A=13:1→A
If non(B:24→B
If B=25:1→B
If pxl-Test(143-8A,32+8B
Goto 2
Pt-Aff(31+8B,24+8A,2,BLANC
T+1→T
If T>dim(L₁:1→T
If pxl-Test(140-8A,31+8B
Then
dim(L₁→C
L₁(C→L₁(C+1
­1→L₁(C
Repeat non(pxl-Test(142-8I,33+8J
nbrAléatEnt(1,24→J
nbrAléatEnt(1,12→I
S+10→S
If S=10:ArrPlanAff ROUGE  // Si le score est égal à 10 je change le fond en rouge
If S=20:ArrPlanAff GRIS     // En gris
If S=30:ArrPlanAff NOIR    // En noir
End
CouleurTexte(BLEU
Texte(20,146,S
Pt-Aff(31+8J,24+8I,3,GRIS CLR
End
Pt-NAff(31+800partDéc(L₁(T)),24+8partEnt(L₁(T
Pt-NAff(31+800partDéc(L₁(T)),24+8partEnt(L₁(T)),2
A+B/100→L₁(T
Goto 1
Lbl 2
EffÉcran
Output(1,1,"GAME OVER
Output(2,1,"SCORE:
Output(2,10,S
Pause
Goto 9
Lbl 0
AxesNAff
EffDess
EffÉcran

Re: 83PCE Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 19:01
by Hayleia
A mon avis, c'est juste parce que la calculatrice ne fonctionne pas avec des couches (genre arrière plan, dessin1 par dessus, dessin2, etc) et ne redessine pas tout à chaque fois non plus. Du coup, quand tu mets ton fond en rouge, il ne change que si tu effaces. Soit en effaçant tout, soit en effaçant partiellement, ce que tu fais derrière ton serpent, d'où la traînée.

But hey, that's just a theory...

Re: 83PCE Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 19:13
by Epharius
Intéressant ! Ça à l'air de n'être un bug que dans les programmes (logique). C'est surement un oubli de la calculatrice dans ses instructions d'effacer l'arrière plan en cours : du coup quand on efface (EDIT : avec pt-off par exemple), ça efface l'ancien arrière plan pour faire place à celui qui a été défini. Donc je rejoins Hayleia. Cependant tu te trompe sur un point : pas besoin d'effacer l'écran quand tu n'es pas sur un programme pour voir le nouveau fond s'afficher.

Re: 83PCE Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 19:15
by Adriweb
J'imagine que c'est l'explication la plus évidente, oui.

Re: 83PCE Bug graphique ? Exploitation possible

PostPosted: 01 Oct 2015, 19:21
by Epharius
Il faudra le signaler à Ti (si ce n'est pas déjà fait) pour l'OS 5.2 ou 5.1.X.X. C'est le genre de bugs qui me font rire, ça se voit qu'il n'y a pas eu de bêta-testeurs ou de recherches approfondies, entre le bug du Menu() et ça x)