From Learn @ Cemetech
Jump to: navigation, search

The basic premise behind Avalanche is to avoid the falling spikes ("V") by moving to the left or right, trying to see how long you can hold out for. It is somewhat more complex than Guess_The_Number, using nested loops, a list variable, and some fairly advanced optimizations. Try to understand the code, and actually put it in your calculator and try it out.

The Code

:Disp "SPEED
:Disp "1) SLOW
:Disp "2) NORMAL
:Disp "3) FAST
:DelVar Z8→X
:Repeat 2>abs(Ans-2
:Disp "SCORE:
:Repeat K=45 or max(X=L1
:Output(8,1,"    // 16 spaces
:Repeat K=45 or F=8
:Output(8,Ans-1," O // 1 space
:Output(F,1,"    // 16 spaces
:DelVar L1ClrHome
:Pause Z

The Download

In case you want to try the program on your calculator, you can download the program in .8xp format.