Created
October 3, 2019 05:51
-
-
Save briangordon/edbb3f317fc34b3dea18c376eb5acb05 to your computer and use it in GitHub Desktop.
Source code for a TI-BASIC implementation of Snake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{11,5,11,5,11,5βLβ | |
1βπ:dim(Lβ)βL | |
1βS:0βT | |
0βC:1βP | |
0βW | |
DelVar [A] | |
{10,26βdim([A] | |
ClrHome | |
While 1 | |
If P | |
Then | |
0βP | |
randInt(W+2,25-WβA | |
randInt(1,10βB | |
While [A](B,A | |
randInt(W+2,25-WβA | |
randInt(1,10βB | |
End | |
Output(B,A,"* | |
End | |
getKeyβPV | |
If PV=26 and Sβ β»1 | |
Then | |
1βS | |
0βT | |
Else | |
If PV=24 and Sβ 1 | |
Then | |
β»1βS | |
0βT | |
Else | |
If PV=34 and Tβ β»1 | |
Then | |
0βS | |
1βT | |
Else | |
If PV=25 and Tβ 1 | |
Then | |
0βS | |
β»1βT | |
End | |
End | |
End | |
End | |
If T | |
randInt(1,10,3 | |
If PMT=A and FV=B | |
Then | |
C+1βC | |
If πβ L-1 | |
Then | |
Lβdim(Lβ | |
For(I,1,L) | |
remainder(π+I+1,L | |
If Ans=0 | |
L | |
Lβ(AnsβLβ(I | |
End | |
LββLβ | |
End | |
L-1βπ | |
L+2βL | |
Lβdim(Lβ | |
Lβ(L-3βLβ(L-1 | |
Lβ(L-2βLβ(L | |
1βP | |
If remainder(C,10)=0 | |
Then | |
W+1βW | |
For(I,1,10 | |
Output(I,W,"X | |
Output(I,27-W,"X | |
End | |
End | |
End | |
remainder(π+2,Lβπ‘ | |
If not(P) and abs(Lβ(π‘)-13.5)<13.5-W | |
Then | |
0β[A](Lβ(π‘+1),Lβ(π‘ | |
Output(Lβ(π‘+1),Lβ(π‘)," | |
End | |
Lβ(π)+SβLβ(π‘ | |
Lβ(π+1)+TβLβ(π‘+1 | |
Lβ(π‘βPMT | |
Lβ(π‘+1βFV | |
If abs(FV-5.5)>4.5 or abs(PMT-13.5)β₯13.5-W | |
Goto D | |
If [A](FV,PMT | |
Goto D | |
Output(FV,PMT,"0 | |
1β[A](FV,PMT | |
π‘βπ | |
End | |
Lbl D | |
ClrHome | |
6βdim(βSNKHS | |
6βdim(βSNKDT | |
CββSNKHS(6 | |
getDate | |
100fPart(Ans(1)/100)+10000Ans(2)+100Ans(3ββSNKDT(6 | |
SortD(βSNKHS,βSNKDT | |
5βdim(βSNKHS | |
Output(2,5,"***************** | |
Output(3,5,"* HIGH SCORES * | |
For(I,1,5 | |
Output(I+3,5,"* . *" | |
Output(I+3,7,I | |
If βSNKHS(I) | |
Output(I+3,10,βSNKHS(I | |
If βSNKDT(I)=0 or βSNKHS(I)β₯10000 | |
Then | |
Else | |
If βSNKDT(I)<100000 | |
Then | |
Output(I+3,14,"0 | |
Output(I+3,15,βSNKDT(I | |
Else | |
Output(I+3,14,βSNKDT(I | |
End | |
End | |
End | |
Output(9,5,"***************** | |
DelVar L:DelVar S | |
DelVar P:DelVar T | |
DelVar C:DelVar I | |
DelVar A:DelVar B | |
DelVar π:DelVar [A] | |
0βπ‘:0βPV:0βPMT:0βFV | |
0βdim(Lβ | |
0βdim(Lβ | |
Disp "","","","","","",""," | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment