Skip to content

Instantly share code, notes, and snippets.

@nbingham1
Created October 5, 2015 00:01
Show Gist options
  • Save nbingham1/f8d0dfa6953d9e62f2d3 to your computer and use it in GitHub Desktop.
Save nbingham1/f8d0dfa6953d9e62f2d3 to your computer and use it in GitHub Desktop.
Brick for the TI-84
ClrHome
ClrDraw
AxesOff
2->Theta
3->L
2->Q
3->O
3->U
-3->V
Lbl 1
Menu("BRICK","PLAY",2,"PREFERENCES",3,"QUIT",4)
Lbl 3
Disp "LIVES"
Prompt L
L->R
Disp "BALL SPEED"
Prompt Theta
sqrt(2)*Theta->U
-sqrt(2)*Theta->V
Disp "PADDLE SPEED"
Prompt O
Disp "PADDLE SIZE"
Prompt Q
Q/2->Q
Goto 1
Lbl2
ClrDraw
[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]->[A]
0->Xmin
94->Xmax
0->Ymin
62->Ymax
24->N
0->S
30->T
0->K
45->P
R->L
RecallPic Pic1
For(A,P-Q,P+Q)
Pt-On(A,0)
End
While N>0 and L>0 and not(K=45)
getKey->K
For(E,0,5)
If K=11+E
Then
For(F,P-Q,P+Q+1)
Pt-Off(F,0)
End
94*E/4->P
For(F,P-Q,P+Q+1)
Pt-On(F,0)
End
End
End
If K=24
Then
For(A,P+Q-O,P+Q)
Pt-Off(A+1,0)
Pt-On(A-2*Q-1,0)
End
P-O->P
End
If K=26
Then
For(A,P-Q,P-Q+O)
Pt-Off(A-1,0)
Pt-On(A+2*Q+1,0)
End
P+O->P
End
If (S+U>94 and U>0) or (S+U<0 and U<0)
U*-1->U
If (T+V>62 and V>0)
V*-1->V
If T+V<1 and V<0
Then
If (S+U>=P-Q and S<=P+Q) or (S+U<=P+Q and S>=P-Q)
Then
-T/V->E
S+EU->A
abs(A-P)->B
If A<P
U-B->U
If A>P
U+B->U
V*-1->V
Else
L-1->L
Pt-Off(S,T)
0->S
30->T
sqrt(2)*Theta->U
-sqrt(2)*Theta->V
End
End
Pt-Off(S,T)
Pt-On(S+U,T+V)
S+U->S
T+V->T
If T+V>38
Then
int((S+U)/6)->A
int((62-(T+V))/4)->B
If A>15
15->A
If B>5
5->B
If A<0
0->A
If B<0
0->B
If [A](B+1,A+1)=1
Then
0->[A](B+1,A+1)
prgmDELBRICK
N-1->N
If not(U=0)
(abs(U)-1)*(U/abs(U))->E
If U=0
0->E
If not(V=0)
(abs(V)-1)*(V/abs(V))->F
If V=0
0->F
If (S+E<=A*6) or (S+E>=A*6+4)
U*-1->U
If (62-(T+F)<=B*4) or (62-(T+F)>=B*4+2)
V*-1->V
End
End
End
Goto 1
Lbl 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment