this is the first program I ever made in TI basic and I know it can be optimized, I just don't know how. it's quite a big program so it might take a while. The program is a simple dungeon crawler that never really ends.
ClrDraw
ClrHome
Clear Entries
0→P
14→X
5→Y
0→L
"θ"→Str1
"#"→Str2
Goto 2
Lbl D
Output(5,13,"Game Over")
Wait 2
{15,3,3→SAVE
Stop
Lbl 2
Menu("Game","Continue",3,"New Game",6,"Quit",4)
Lbl O4
Menu("Style?","#",O5,"X",O6)
Lbl O5
"#"→Str2
Goto 6
Lbl O6
"X"→Str2
Goto 6
Lbl C9
randInt(1,5)→Z
randInt(0,4)→W
randInt(0,3)→S
Z+H→H
W+A→A
S+D→D
Output(4,12,Z
Output(5,12,W
Output(6,12,S
Output(4,11,"+"
Output(5,11,"+"
Output(6,11,"+"
Output(4,13," Health"
Output(5,13," Attack"
Output(6,13," Defence"
0→[A](Y,X)
Pause
For(R,4,6)
For(Q,11,20)
If [A](R,Q)=1
Then
Output(R,Q,Str2)
End
If [A](R,Q)=0
Then
Output(R,Q," ")
End
If [A](R,Q)=2
Then
Output(R,Q,"E")
End
If [A](R,Q)=3
Then
Output(R,Q,"C")
End
End
End
Goto 5
Lbl 7
Output(1,1," ")
Output(2,1," ")
Output(3,1," ")
Output(4,1," ")
Output(5,1," ")
Output(6,1," ")
Output(7,1," ")
For(Q,1,26)
Output(8,Q,"#")
End
For(Q,1,26)
Output(9,Q,"#")
End
Output(10,14,"#")
Output(7,21,"||")
Output(6,19,"+/(")
Output(6,22,")\")
Output(5,21,"O")
Output(5,19,"|")
Output(7,2,"||")
Output(6,1,"/(")
Output(6,3,")\+")
Output(5,3,"O")
Output(5,5,"|")
round(H,0)→H
randInt(H-5,H+15)→E
E→G
randInt(A-2,A+3)→V
H→B
randInt(D-2,D+3)→I
If I>A
A-3→I
Goto C1
Lbl C1
Output(4,2,E
If E<5
Then
If E≤0
Then
Goto WN
End
End
Output(4,21," ")
Output(4,21,H)
Output(4,2," ")
Output(4,2,E)
Wait 0.5
Output(3,20," ")
Output(3,1," ")
If H≤0
Then
Goto D
End
Menu("What Will You Do","Attack",A1,"Heal",H)
Lbl WN
0→[A](Y,X)
H+5→H
If M=11
Goto M1
If M=12
Goto M2
If M=13
Goto M3
If M=14
Goto M4
If M=15
Goto M5
Goto 82
Lbl H
H+2+(1.5D)→H
If H>1.5B
H-5→H
If H>2B
B→H
round(H,1)→H
Goto E1
Lbl A1
E-1.2A→E
Output(3,1,"-")
Output(3,3,1.2A)
Goto E1
Lbl E1
randInt(1,2)→J
If J=1
Goto E2
If J=2
Then
E+I→E
Goto C1
End
Lbl E2
randInt(1,3)→J
If J=1
Then
Output(3,20,"miss")
Goto C1
End
If J>1
H-0.8V→H
Output(3,20,"-")
Output(3,21,0.8V)
Goto C1
End
Lbl 6
15→H
3→A
3→D
Goto 9
Lbl 1
Menu("Pause","Continue",5,"Inventory",I,"Save & Quit",4)
Lbl I
For(R,1,10
For(Q,1,26
Output(R,Q," ")
End
End
Disp "Health"
Disp H
Disp "Attack"
Disp A
Disp "Defence"
Disp D
Pause
Goto 82
Lbl 4
{H,A,D→SAVE
ClrHome
ClrDraw
Stop
Lbl 3
⌊SAVE(1→H
⌊SAVE(2→A
⌊SAVE(3→D
Goto 9
Lbl 9
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP201
{1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1→⌊MP202
{1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1→⌊MP203
{1,1,1,1,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1→⌊MP204
{0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0→⌊MP205
{1,1,1,1,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1→⌊MP206
{1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1→⌊MP207
{1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1→⌊MP208
{1,1,1,1,1,1,1,1,0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,1,1,1→⌊MP209
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP210
Listmatr(⌊MP201,⌊MP202,⌊MP203,⌊MP204,⌊MP205,⌊MP206,⌊MP207,⌊MP208,⌊MP209,⌊MP210,[A]
[A]→[A]
Output(1,1,"############# ############")
Output(2,1,"####### # ### ### # ######")
Output(3,1,"###### # # # # #####")
Output(4,1,"####### # # # # ######")
Output(5,1," # # ")
Output(6,1,"####### # # # # ######")
Output(7,1,"###### # # # # #####")
Output(8,1,"####### # ### ### # ######")
Output(9,1,"######## # # # # #######")
Output(10,1,"############# ############")
Goto 5
Lbl X
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP101
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP102
{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→⌊MP103
{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→⌊MP104
{0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0→⌊MP105
{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→⌊MP106
{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→⌊MP107
{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→⌊MP108
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP109
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP110
Listmatr(⌊MP101,⌊MP102,⌊MP103,⌊MP104,⌊MP105,⌊MP106,⌊MP107,⌊MP108,⌊MP109,⌊MP110,[A]
[A]→[A]
Goto 8
Lbl 10
randInt(11,15)→M
If M=K
Goto 10
M→K
DelVar [A]
{10,26→dim([A]
If M=11
Goto 11
If M=12
Goto 12
If M=13
Goto 13
If M=14
Goto 14
If M=15
Goto 15
If M=16
Goto 16
Lbl 11
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP101
{1,1,0,0,0,1,0,0,1,1,0,1,1,0,0,0,1,3,1,0,0,0,1,1,3,1→⌊MP102
{1,3,0,1,0,0,2,1,0,0,0,0,0,1,1,0,0,2,1,0,1,0,1,0,0,1→⌊MP103
{1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,0,1,1,0,0,1,0,1,2,1,1→⌊MP104
{0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,2,0,0,1,1,0,0,0,0,0→⌊MP105
{1,1,1,0,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1→⌊MP106
{1,3,1,0,1,0,1,1,0,0,1,0,2,0,1,0,0,1,0,0,0,0,1,0,0,1→⌊MP107
{1,0,0,0,1,0,0,2,1,0,1,0,1,0,1,1,0,2,0,1,1,0,0,1,0,1→⌊MP108
{1,1,0,1,3,0,1,0,0,0,0,1,1,0,1,3,0,1,0,0,3,1,0,0,0,1→⌊MP109
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP110
Listmatr(⌊MP101,⌊MP102,⌊MP103,⌊MP104,⌊MP105,⌊MP106,⌊MP107,⌊MP108,⌊MP109,⌊MP110,[A]
[A]→[A]
Goto M1
Lbl M1
Output(1,1,"############# ############")
Output(2,1,"## # ## ## #C# ##C#")
Output(3,1,"#C # E# ## E# # # #")
Output(4,1,"###### # ## # ## # #E##")
Output(5,1," # # # E ## ")
Output(6,1,"### ## ### ###### ### ##")
Output(7,1,"#C# # ## # E # # # #")
Output(8,1,"# # E# # # ## E ## # #")
Output(9,1,"## #C # ## #C # C# #")
Output(10,1,"############# ############")
Goto 5
Lbl 12
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP101
{1,0,0,0,1,3,1,3,1,0,2,0,1,0,1,3,1,0,0,1,0,1,1,0,3,1→⌊MP102
{1,3,1,0,2,0,1,0,1,3,1,0,0,0,1,0,2,0,1,0,0,0,0,0,1,1→⌊MP103
{1,1,0,0,1,1,1,2,0,1,0,0,1,1,1,1,1,0,0,0,1,0,1,0,0,1→⌊MP104
{0,0,1,2,1,0,0,1,0,1,0,1,0,0,0,1,0,0,1,1,1,0,0,1,0,0→⌊MP105
{1,0,0,0,1,1,0,0,0,1,0,0,0,1,0,1,1,0,1,3,2,1,0,0,1,1→⌊MP106
{1,1,1,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,1,0,1,1,0,1,1→⌊MP107
{1,0,0,0,1,0,0,0,1,0,1,3,0,1,1,0,1,1,1,1,0,0,0,0,0,1→⌊MP108
{1,3,1,0,2,0,1,0,0,0,1,1,0,0,0,0,0,1,3,0,2,1,0,1,0,1→⌊MP109
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP110
Listmatr(⌊MP101,⌊MP102,⌊MP103,⌊MP104,⌊MP105,⌊MP106,⌊MP107,⌊MP108,⌊MP109,⌊MP110,[A]
[A]→[A]
Goto M2
Lbl M2
Output(1,1,"############# ############")
Output(2,1,"# #C#C# E # #C# # ## C#")
Output(3,1,"#C# E # #C# # E # ##")
Output(4,1,"## ###E # ##### # # #")
Output(5,1," #E# # # # # ### # ")
Output(6,1,"# ## # # ## #CE# ##")
Output(7,1,"### # ## ## # ## ##")
Output(8,1,"# # # #C ## #### #")
Output(9,1,"#C# E # ## #C E# # #")
Output(10,1,"############# ############")
Goto 5
Lbl 13
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP101
{1,3,0,1,0,0,1,3,1,1,0,3,1,0,1,1,3,1,0,0,0,3,1,2,0,1→⌊MP102
{1,1,2,1,0,1,1,0,0,2,0,1,0,0,0,0,0,2,0,1,0,1,1,0,1,1→⌊MP103
{1,0,0,0,0,0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,0,1,0,0,0,1→⌊MP104
{0,0,1,0,1,0,1,0,1,0,1,0,0,0,2,1,0,1,0,1,0,0,0,1,0,0→⌊MP105
{1,0,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,1,0,1,1→⌊MP106
{1,1,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,0,0,0,2,0,1,1→⌊MP107
{1,3,0,1,0,1,1,1,0,0,0,0,1,1,0,2,1,0,1,0,1,1,0,1,3,1→⌊MP108
{1,1,0,0,2,0,0,3,1,0,1,0,0,0,0,1,0,0,1,0,3,1,0,0,0,1→⌊MP109
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP110
Listmatr(⌊MP101,⌊MP102,⌊MP103,⌊MP104,⌊MP105,⌊MP106,⌊MP107,⌊MP108,⌊MP109,⌊MP110,[A]
[A]→[A]
Goto M3
Lbl M3
Output(1,1,"############# ############")
Output(2,1,"#C # #C## C# ##C# C#E #")
Output(3,1,"##E# ## E # # # ## ##")
Output(4,1,"# ### ## # ## # #")
Output(5,1," # # # # # E# # # # ")
Output(6,1,"# # # ## # # # # ##")
Output(7,1,"#### # ## ## # E ##")
Output(8,1,"#C # ### ## E# # ## #C#")
Output(9,1,"## E C# # # # C# #")
Output(10,1,"############# ############")
Goto 5
Lbl 14
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP101
{1,3,0,0,0,2,0,0,1,3,1,0,0,0,0,0,0,1,2,0,3,1,1,0,3,1→⌊MP102
{1,1,1,1,0,1,0,1,0,0,0,2,1,1,0,1,0,0,0,1,1,0,0,0,1,1→⌊MP103
{1,0,0,0,1,0,0,1,1,1,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1→⌊MP104
{0,0,1,0,1,0,1,0,0,0,0,1,0,1,1,0,1,0,0,0,1,1,0,1,0,0→⌊MP105
{1,1,1,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,2,0,1,1,1→⌊MP106
{1,0,0,0,1,1,0,1,0,1,1,1,1,0,0,1,1,3,1,0,1,1,0,0,0,1→⌊MP107
{1,1,2,1,3,1,2,1,0,0,2,0,1,1,0,0,0,2,1,0,0,0,1,0,1,1→⌊MP108
{1,3,0,1,0,0,0,3,1,3,1,0,0,0,0,1,0,1,0,0,1,1,3,0,0,1→⌊MP109
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP110
Listmatr(⌊MP101,⌊MP102,⌊MP103,⌊MP104,⌊MP105,⌊MP106,⌊MP107,⌊MP108,⌊MP109,⌊MP110,[A]
[A]→[A]
Goto M4
Lbl M4
Output(1,1,"############# ############")
Output(2,1,"#C E #C# #E C## C#")
Output(3,1,"#### # # E## # ## ##")
Output(4,1,"# # #### # # # # #")
Output(5,1," # # # # ## # ## # ")
Output(6,1,"### ## # ## E ###")
Output(7,1,"# ## # #### ##C# ## #")
Output(8,1,"##E#C#E# E ## E# # ##")
Output(9,1,"#C # C#C# # # ##C #")
Output(10,1,"############# ############")
Goto 5
Lbl 15
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP101
{1,3,0,0,2,0,1,3,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,3,1→⌊MP102
{1,1,1,0,1,3,1,0,0,1,0,0,0,1,3,0,1,0,0,1,1,0,0,0,1,1→⌊MP103
{1,0,0,2,1,1,0,1,2,0,0,1,1,0,1,0,0,0,1,0,3,1,0,1,1,1→⌊MP104
{0,0,1,0,0,1,2,0,0,1,0,0,1,0,2,0,1,1,0,2,1,0,0,1,0,0→⌊MP105
{1,1,3,1,0,1,0,1,1,3,1,0,1,0,1,1,3,1,0,1,0,0,1,0,0,1→⌊MP106
{1,0,0,2,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,1→⌊MP107
{1,2,1,1,0,0,1,0,2,0,1,1,2,1,0,0,1,2,1,0,2,0,0,1,3,1→⌊MP108
{1,0,3,3,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,3,1,1,0,2,0,1→⌊MP109
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP110
Listmatr(⌊MP101,⌊MP102,⌊MP103,⌊MP104,⌊MP105,⌊MP106,⌊MP107,⌊MP108,⌊MP109,⌊MP110,[A]
[A]→[A]
Goto M5
Lbl M5
Output(1,1,"############# ############")
Output(2,1,"#C E #C# # # # # C#")
Output(3,1,"### #C# # #C # ## ##")
Output(4,1,"# E## #E ## # # C# ###")
Output(5,1," # #E # # E ## E# # ")
Output(6,1,"##C# # ##C# # ##C# # # #")
Output(7,1,"# E # # # # # # ##")
Output(8,1,"#E## # E ##E# #E# E #C#")
Output(9,1,"# CC# # # # #C## E #")
Output(10,1,"############# ############")
Goto 5
Lbl 16
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP101
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP102
{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→⌊MP103
{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→⌊MP104
{0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0→⌊MP105
{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→⌊MP106
{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→⌊MP107
{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→⌊MP108
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP109
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1→⌊MP110
Listmatr(⌊MP101,⌊MP102,⌊MP103,⌊MP104,⌊MP105,⌊MP106,⌊MP107,⌊MP108,⌊MP109,⌊MP110,[A]
[A]→[A]
Goto 8
Lbl 82
Output(1,1,"############# ############"
For(R,2,9
Output(R,1,"#"
Output(R,26,"#"
End
Output(5,1," "
Output(5,26," "
Output(10,1,"############# ############"
Goto 8
Lbl 8
For(R,2,9
For(Q,2,25
If [A](R,Q)=1
Then
Output(R,Q,Str2)
End
If [A](R,Q)=0
Then
Output(R,Q," ")
End
If [A](R,Q)=2
Then
Output(R,Q,"E")
End
If [A](R,Q)=3
Then
Output(R,Q,"C")
End
End
End
Goto 5
Lbl 5
0→P
While 1=1
Output(Y,X,Str1)
getKey→P
If P=24
Then
If X-1=0
Then
Output(Y,X," ")
26→X
Output(Y,X,Str1)
Goto 10
Else
If [A](Y,X-1)=2
Then
Output(Y,X," ")
X-1→X
Goto 7
End
If [A](Y,X-1)=3
Then
Output(Y,X," ")
X-1→X
Goto C9
End
If [A](Y,X-1)=0
Then
Output(Y,X," ")
X-1→X
End
End
Output(Y,X,Str1)
Else
If P=34
Then
If Y+1=11
Then
Output(Y,X," ")
1→Y
Output(Y,X,Str1)
Goto 10
Else
If [A](Y+1,X)=2
Then
Output(Y,X," ")
Y+1→Y
Goto 7
End
If [A](Y+1,X)=3
Then
Output(Y,X," ")
Y+1→Y
Goto C9
End
If [A](Y+1,X)=0
Then
Output(Y,X," ")
Y+1→Y
End
End
Output(Y,X,Str1)
Else
If P=25
Then
If Y-1=0
Then
Output(Y,X," ")
10→Y
Output(Y,X,Str1)
Goto 10
Else
If [A](Y-1,X)=2
Then
Output(Y,X," ")
Y-1→Y
Goto 7
End
If [A](Y-1,X)=3
Then
Output(Y,X," ")
Y-1→Y
Goto C9
End
If [A](Y-1,X)=0
Then
Output(Y,X," ")
Y-1→Y
End
End
Output(Y,X,Str1)
Else
If P=26
Then
If X+1=27
Then
Output(Y,X," ")
1→X
Output(Y,X,Str1)
Goto 10
Else
If [A](Y,X+1)=2
Then
Output(Y,X," ")
X+1→X
Goto 7
End
If [A](Y,X+1)=3
Then
Output(Y,X," ")
X+1→X
Goto C9
End
If [A](Y,X+1)=0
Then
Output(Y,X," ")
X+1→X
End
End
Output(Y,X,Str1)
End
If P=105
Then
Goto 1
End
1+L→L
If L>5
Then
"θ"→Str1
End
If L>10
Then
"0"→Str1
0→L
End
0→P
End
End
End
End
End
End
End
End
End