In this simple program a point traverses an array diagonally and bounces off the walls. Every pixel it touches changes color.
On my TI 84+ CE, the infinite while loop stops prematurely at the same spot every time. Why?
0→X
0→Y
1→C
1→D
{11,20→dim([A]
For(E,1,20,1)
For(F,1,11,1)
0→[A](F,E)
End
End
{1,2→dim([B]
21→[B](1,1
21→[B](1,2
{1,2→dim([C]
12→[C](1,1
12→[C](1,2
ClrHome
ClrDraw
While 1
If X≠[B](1,2) and Y≠[C](1,2)
Then
Pxl-On(Y,X,RED
X+C→X
Y+D→Y
Else
If X≥[B](1,2)
Then
[B](1,1)-[B](1,2)→[B](1,2)
C1→C
End
If Y≥[C](1,2)
Then
[C](1,1)-[C](1,2)→[C](1,2)
D1→D
End
End
End