Written Code

Myles_Zadok 07 Aug 2017 20:56

Here is the written code for this game (which actually works well on all calculator models, though it could stand to be optimized…)

```
"BEN→Str5
"BEN→Str6
"BEN→Str7
30→dim(⌊STRSM
ClrHome
Lbl G
Menu("STARSMASH!","PLAY",B,"INSTRUCTIONS",A,"HIGHSCORES",C,"ABOUT",E,"EXIT",D)
Lbl C
ClrHome
Output(1,4,"HIGHSCORES
Output(3,2,"1.
Output(4,2,"2.
Output(5,2,"3.
Output(3,5,⌊STRSM(1)
Output(4,5,⌊STRSM(2)
Output(5,5,⌊STRSM(3)
Output(3,10,Str5
Output(4,10,Str6
Output(5,10,Str7
Pause
ClrHome
Goto G
Lbl E
ClrHome
Output(2,2,"PROGRAMMED BY
Output(3,3,"BEN EVERMAN
Output(5,3,"VERSION 1.0
Pause
ClrHome
Goto G
Lbl D
ClrHome
Stop
End
Lbl B
Output(1,4,"STARSMASH!
Output(3,1," O [ O
Output(4,8,":>
Output(5,1," O [ O
Output(7,2,"ENTER TO START
Pause
Goto 6
End
Lbl A
Output(1,1,"-PRESS MODE
Output(2,1,"TO SHOOT
Output(4,1,"-PRESS ARROWS
Output(5,1,"TO MOVE
Output(7,1,"-PRESS ENTER
Output(8,1,"TO PAUSE
Pause
ClrHome
Goto G
End
If M=15
Goto 6
Goto 4
End
Lbl 6
randInt(2,7)→A
randInt(2,7)→Y
16→B
16→C
2→L
3→Z
0→Q
0→S
0→P
Lbl 1
C-1→C
B-1→B
ClrHome
Output(1,5,"SCORE:
Output(1,12,S
Output(L,1,"[
Output(L+1,1,":>
Output(L+2,1,"[
Output(A,B,"*
Output(Y,C,"*
getKey→K
If K=25 and L≠1
L-1→L
If K=34 and L≠6
L+1→L
If K=22
Output(L+1,Z,"))))))))))))))
If A=L+1 and 3<B<7 and K=22:Then
randInt(2,7)→A
16→B
S+1→S
End
If Y=L+1 and 3<C<7 and K=22:Then
randInt(2,7)→Y
16→C
S+1→S
End
If C=1:Then
ClrHome
Output(4,2,"YOU EPIC FAIL!
Output(6,2,"SCORE:
Output(6,9,S
Pause
Goto 2
End
If B=1:Then
ClrHome
Output(4,2,"YOU EPIC FAIL!
Output(6,2,"SCORE:
Output(6,9,S
Pause
Goto 2
Stop
End
If C=2 and Y=L+1:Then
ClrHome
Output(4,2,"YOU EPIC FAIL!
Output(6,2,"SCORE:
Output(6,9,S
Goto 2
End
If B=2 and A=L+1:Then
ClrHome
Output(4,2,"YOU EPIC FAIL!
Output(6,2,"SCORE:
Output(6,9,S
Lbl 2
If S≥⌊STRSM(1)
Then:⌊STRSM(2)→⌊STRSM(3)
⌊STRSM(1)→⌊STRSM(2)
S→⌊STRSM(1)
ClrHome
Output(1,1,"NEW HIGHSCORE!
Pause
Str6→Str7
Str5→Str6
ClrHome
Input "INITIALS? ",Str5
End
If S≥⌊STRSM(2) and S<⌊STRSM(1)
Then:⌊STRSM(2)→⌊STRSM(3)
S→⌊STRSM(2)
ClrHome
Output(1,1,"NEW HIGHSCORE!
Pause
Str6→Str7
ClrHome
Input "INITIALS? ",Str6
End
If S≥⌊STRSM(3) and S<⌊STRSM(2)
Then:S→⌊STRSM(3)
ClrHome
Output(1,1,"NEW HIGHSCORE!
Pause
DelVar Str7
ClrHome
Input "INITIALS? ",Str7
End
ClrHome
Goto G
End
If B=1:Then
randInt(2,7)→A
16→B
End
If C=1:Then
randInt(2,7)→Y
16→C
End
If K=21
Stop
If K=105
Pause
1→X
2→X
3→X
4→X
5→X
6→X
7→X
8→X
Goto 1
```