TI-BASIC Wiki
Advertisement

This is a standard avalanche game where you dodge falling icicles. I am still improving my high score system, if anybody would like to contribute to it.

Variables[]

You need the following variables:

A

B

θ

LAVAL

LAVALH

Str0

Str1

If you already have a use for Str0 or Str1, you can replace them with any other string, provided you don't accidently confuse them. Str0 can be blank, it is only used for input purposes. Str1 needs to be unchanging.

How to Play[]

You are the "X"

Icicles are "V"s.

Use the left and right arrows to move.

You get one point for every icicle you dodge.

The first 4 icicles will not start on top of you, but the others will.

Press Mode to pause.

Press Clear to end it.

Press Del to quickly escape so that no-one knows what you were doing.

Code[]

8→dim(LAVAL
8→dim(LAVALH
If length(Str1)≠64
Then
" →Str1
Repeat length(Str1)≥64
Str1+"   →Str1
End
sub(Str1,1,64→Str1
End
Lbl 0
ClrHome
Menu("   AVALANCHE!   ","PLAY",1,"INSTRUCTIONS",2,"HIGH SCORES",3,"QUIT",4
Lbl 4
ClrHome
Output(1,1," 
Return
Lbl 2
ClrHome
Output(1,1,"'X' = YOU
Output(2,1,"'V' = ICICLE
Output(3,1,"< = GO LEFT
Output(4,1,"> = GO RIGHT
Output(5,1,"MODE = PAUSE
Output(6,1,"CLEAR = END
Output(7,1,"DEL = EXIT FAST
Pause
ClrHome
Goto 0
Lbl 3
ClrHome
Disp "sub(Str1,1,8)","sub(Str1,9,8)","sub(Str1,17,8)","sub(Str1,25,8)","sub(Str1,33,8)","sub(Str1,41,8)","sub(Str1,49,8
Output(8,1,"sub(Str1,56,8
Output(1,1,LAVALH(1
Output(2,1,LAVALH(2
Output(3,1,LAVALH(3
Output(4,1,LAVALH(4
Output(5,1,LAVALH(5
Output(6,1,LAVALH(6
Output(7,1,LAVALH(7
Output(8,1,LAVALH(8
Pause
ClrHome
Goto 0
Lbl 1
ClrHome
randInt(8,9)→A
0→B
{A,A,A,A}→LAVAL
Repeat sum(LAVAL≠A)=0
randInt(1,16,4)→LAVAL
End
augment(randInt(1,16,4),LAVAL)→LAVAL
getKey
0→θ
While LAVAL(8)≠A and θ≠23 and θ≠45
ClrHome
Output(1,LAVAL(1),"V
Output(2,LAVAL(2),"V
Output(3,LAVAL(3),"V
Output(4,LAVAL(4),"V
Output(5,LAVAL(5),"V
Output(6,LAVAL(6),"V
Output(7,LAVAL(7),"V
Output(8,LAVAL(8),"V
Output(8,A,"X
getKey→θ
If θ=22
Pause
A+(θ=26 and A<16)-(θ=24 and A>1→A
LAVAL(7)→LAVAL(8
LAVAL(6)→LAVAL(7
LAVAL(5)→LAVAL(6
LAVAL(4)→LAVAL(5
LAVAL(3)→LAVAL(4
LAVAL(2)→LAVAL(3
LAVAL(1)→LAVAL(2
randInt(1,16)→LAVAL(1
B+1→B
End
ClrHome
If θ=23
Goto 4
Output(1,LAVAL(1),"V
Output(2,LAVAL(2),"V
Output(3,LAVAL(3),"V
Output(4,LAVAL(4),"V
Output(5,LAVAL(5),"V
Output(6,LAVAL(6),"V
Output(7,LAVAL(7),"V
getKey
0→θ
Repeat θ≠0
getKey→θ
Output(1,LAVAL(8),"V
Output(1,A,"X
End
ClrHome
Output(1,1,"SCORE:
Output(1,8,B
Pause
ClrHome
If B>LAVALH(8
Then
"       "→Str0
Repeat Str0≠"       "
Input "NAME: ",Str0
ClrHome
End
Str0+":"→Str0
If B>LAVALH(1
Str0+sub(Str1,1,56)→Str1
If LAVALH(1)>B and B≥LAVALH(2
sub(Str1,1,8)+Str0+sub(Str1,9,48→Str1
If LAVALH(2)>B and B≥LAVALH(3
sub(Str1,1,16)+Str0+sub(Str1,17,40→Str1
If LAVALH(3)>B and B≥LAVALH(4
sub(Str1,1,24)+Str0+sub(Str1,25,32→Str1
If LAVALH(4)>B and B≥LAVALH(5
sub(Str1,1,32)+Str0+sub(Str1,33,24→Str1
If LAVALH(5)>B and B≥LAVALH(6
sub(Str1,1,40)+Str0+sub(Str1,41,16→Str1
If LAVALH(6)>B and B≥LAVALH(7
sub(Str1,1,48)+Str0+sub(Str1,49,8→Str1
If LAVALH(7)>B and B≥LAVALH(8
sub(Str1,1,56)+Str0→Str1
B→LAVALH(8
SortD(LAVALH
End
Goto 0
Advertisement