Skip to content

Instantly share code, notes, and snippets.

@nbingham1
Last active October 4, 2015 23:55
Show Gist options
  • Save nbingham1/5da2b29b7d05e509db63 to your computer and use it in GitHub Desktop.
Save nbingham1/5da2b29b7d05e509db63 to your computer and use it in GitHub Desktop.
Snake for the TI-84
0->X
0->Y
1->L
pi/2->A
0->R
2->M
0->D
0->E
0->F
cos(pi/2)*M->S
sin(pi/2)*M->T
pi/6->C
0->I
0->L1(1)
0->L1(2)
0->L2(1)
0->L2(2)
AxisOff
ZStandard
ZSquare
While X>-15.16129 and X<15.16129 and Y>-10 and Y<10
getKey->K
If K=24
Then
cos(A+C)*M->S
sin(A+C)*M->T
C->R
End
If K=26
Then
cos(A-C)*M->S
sin(A-C)*M->T
-C->R
End
If not(K=24) and not(K=26)
0->R
A+R->A
Line(X, Y, X+S, Y+T)
X+S->X
Y+T->Y
I-(L+1)*int(I/(L+1))+1->P
While L1(P)=-999
P-(L+1)*int(P/(L+1))+1->P
End
P-(L+1)*int(P/(L+1))+1->Q
While L1(Q)=-999
Q-(L+1)*int(Q/(L+1))+1->Q
End
Line(L1(P), L2(P), L1(Q), L2(Q), 0)
I-(L+1)*int(I/(L+1))+1->I
X->L1(I)
Y->L2(I)
If abs(X-E)<1.5 and abs(Y-F)<1.5
Then
0->D
L+1->L
-999->L1(L+1)
-999->L2(L+1)
Pt-Off(E,F)
End
If D=0
Then
randInt(-140,140)/10->E
randInt(-90,-90)/10->F
Pt-On(E,F)
1->D
End
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment