This absolute unit of a program was my largest and most recent project to ever grace my eyes, and now yours get to suffer as well.

Below is the source code to Crawler, a TI-Basic rouge-like which can be found in the Cemetech Archives. However, it is clear that programming on a 16x7 character screen is not very helpful for organization and optimization.
If you want to try to optimize this as a challenge then may the devil help you because even God himself cannot comprehend this masterpiece.

Program Name: Crawler
Length: 466 Lines
Size: 12016 Bytes
Dependencies: 1
prgmTEXTINV (Compiled to Assembly from Hexadecimal on the TI-84+ Monochrome)

Code:
ClrHome
[CLASSIC]
Disp "Loading..\."
"OOOOOOOOO      OO      OO      OO      OO      OO      OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO     OOO     OOO  OOOOOO  OOOOOO  OOOOOOOOOOOOOOOOOOOOOOOOOOO                OOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO     OOO     OOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOO                OOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO     OOO     OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO     OOO     OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOO                OOOOOOOOOOOOOOOOOOOOOOOOOOO  OOOOOO  OOOOOO  OOO     OOO     OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOO     OOO     OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOO  OOOOOOOOOOOOOOOOOOOOOOOOOOO                OOOOOOOOOOOOOOOOOOOOOOOOOOO  OOOO      OO      OO      OO      OO      OO      OOOOOOOOOOOOOOOOOO      OO      O       O       OO      OO      OOOOOOOOOOOOOOOOOO      OO      OO      OO      OO      OO      OOOO  OOOOOOOOOOOO      OO      OO       O       O      OO      OOOOOOOOOOOOOOOOOO      OO      OO      OO      OO      OO      OOOOOOOOOOOO  OOOO      OO      O                O      OO      OOOO  OOO"->Str6
ClrHome
Asm(prgmTEXTINV
Output(1,1,"   TI-CRAWLER   
Asm(prgmTEXTINV
Output(4,1,"    Coded By     DragonScholar7
Asm(prgmTEXTINV
Output(8,1,"v1.5.0          ")
Asm(prgmTEXTINV
For(W,~1500,0:End
Asm(prgmTEXTINV
Output(1,1,"    CONTROLS   
Asm(prgmTEXTINV
Output(3,1,"Menu - [MODE]   Accept - [2nd]  Move - Arrows                   "
For(W,~1500,0:End
ClrHome
1->M
70->dim(|LCRAWL
Lbl 1
If M=0
1->|LCRAWL(14
If |LCRAWL(2)<=0:Then
   0->|LCRAWL(14
   0->M
End
If |LCRAWL(14)=0:Then
   ClrHome
   For(W,0,1
      Output(1,1," Generating Map
      Asm(prgmTEXTINV
   End
   {8,7->dim([A]
   Fill(0,[A]
   17->[A](4,4
   {4,3,4,5}->|LX
   {3,4,5,4}->|LY
   Output(4,4,"H
   ~1->C:Ans->F
   0->D
   {0,0,0,0->L2
   While C=F
      C+1->C
      {|LX(1),|LY(1->L1
      Output(2,9,C
      Output(4,9,D
      Output(3,9," 
      Output(3,9,dim(|LX
      If [A](L1(2),L1(1))=0:Then
         D+1->D
         L1(1->S
         L1(2->T
         {[A](T-not(T=1),S)-(T=1),[A](T,S-not(S=1))-(S=1),[A](T+not(T=8),S)-(T=8),[A](T,S+not(S=7))-(S=7->L4
         L4->L2
         randInt(0,(L2={0,0,0,0->L3
         sum(L2(1)={1,2,3,4,6,8,10,17->L2(1
         sum(L2(2)={1,2,3,4,5,7,11,17->L2(2
         sum(L2(3)={3,4,5,7,8,9,10,17->L2(3
         sum(L2(4)={2,4,6,7,8,9,11,17->L2(4
         max(0,min(1,L2+L3->L2
         sum((sum(L2*{1,2,4,8})={12,14,13,15,9,6,11,7,3,5,10,1,2,4,8})*{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15->[A](L1(2),L1(1
         If L1(2)>1
         Output(L1(2),L1(1),sub("123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Ans,1
         If L2(1:Then
            |LY(1)-1->|LY(1+dim(|LY
            |LX(1)->|LX(1+dim(|LX
         End
         If L2(2:Then
            |LX(1)-1->|LX(1+dim(|LX
            |LY(1)->|LY(1+dim(|LY
         End
         If L2(3:Then
            |LY(1)+1->|LY(1+dim(|LY
            |LX(1)->|LX(1+dim(|LX
         End
         If L2(4):Then
            |LX(1)+1->|LX(1+dim(|LX
            |LY(1)->|LY(1+dim(|LY
      End:End
      If dim(|LX)>1:Then
         DeltaList(cumSum(|LX->|LX
         DeltaList(cumSum(|LY->|LY
         C->F
      End
   End
   ClrHome
   17.1->[A](4,4
   DelVar |LXDelVar |LY
   Disp "Map Generated
End
{0->L5
If M=0 and |LCRAWL(14)=0:Then
   2->|LCRAWL(1
   20->|LCRAWL(2
   4->|LCRAWL(8
   Ans->|LCRAWL(9
   Ans->|LCRAWL(12
   5->|LCRAWL(10
   Ans->|LCRAWL(11
   .5->|LCRAWL(13
   D+1->|LCRAWL(6
   4->|LCRAWL(8
   Ans->|LCRAWL(9
   5->|LCRAWL(10
   Ans->|LCRAWL(11
   For(N,1,8
      For(O,1,7
         [A](N,O->|LCRAWL((N-1)7+O+14
      End
   End
Else
   {8,7->dim([A]
   For(N,1,8
      For(O,1,7
         |LCRAWL((N-1)7+O+14->[A](N,O
      End
   End
End
|LCRAWL(10->X:Ans->A:|LCRAWL(11->Y:Ans->B:{|LCRAWL(8),|LCRAWL(9->L1
1->G
Disp "Loading Display
" ->Str2
For(S,1,8
   Str2+"|->Str2
   For(T,1,7
      [A](S,T
      1+fPart(Ans)10+sum(fPart(Ans)10*iPart(Ans)={12,13,14,15})+(Ans>0
      Str2+sub("- plotdotplotcross",Ans,1->Str2
   End
End
sub(Ans,2,length(Ans)-1->Str2
Disp "Finalizing
sub(Str6,iPart([A](L1(2),L1(1)))64+1,64->Str1
"
For(S,0,7
   Ans+"        "+sub(Str2,S8+1,8
End
sub(Ans,2,length(Ans)-1->Str3
0->T
For(S,1,7
   Matr>list([A],S,L6
   T+sum(fPart(L6)10->T
End
T->|LCRAWL(7
Repeat |LCRAWL(6)=|LCRAWL(7
   sub(Str6,iPart([A](L1(2),L1(1)))64+1,64->Str1
   "
   For(S,0,63,8
      Ans+sub(Str1,S+1,8)+sub(Str3,S2+9,8
   End
   sub(Ans,2,length(Ans)-1->Str3
   1->U
   While U
      0->U
      Output(1,1,Str3
      Output(L1(2),9+L1(1),"plotsquare
      If not(fPart([A](L1(2),L1(1:Then
         If sum([A](L1(2),L1(1))={12,13,14,15})+(randInt(1,10)=5:Then
            Asm(prgmTEXTINV
            Output(4,1,"    Encounter   
            Asm(prgmTEXTINV
         For(W,~500,0:End
            For(T,1,4
               For(S,1,15,2
                  Output(T,S," 
                  Output(abs(T-9),abs(S-16)," 
            End:End
            {4,4,iPart(randInt(5,15)*.3(|LCRAWL(1))),randInt(1,3->L6
            X->I:Y->J
            "
            For(S,0,7
               Ans+sub(Str1,S8+1,8)+"|       
            End
            sub(Ans,2,length(Ans)-1->Str2
            |LCRAWL(2->V
            L6(3->R
            getKey
            Repeat (|LCRAWL(2)<=0)+(L6(3)<=0
               I->X:J->Y
               {randInt(4,5),randInt(4,5),L6(3),L6(4->L6
               Output(1,1,Str2
               Output(7,10,"Enemy-
               Output(8,10,"HP   
               Output(8,12,L6(3
               Output(1,10,"HP     
               Output(1,12,|LCRAWL(2
               Output(2,10,"2nd-
               Output(3,10,"Skip-
               1->R:1->Q
               0->H
               Repeat (L6(1)=X)(L6(2)=Y)+H
                  1->M
                  Output(L6(2),L6(1),sub("MX*",L6(4),1
                  Output(Y,X,"pi
                  Repeat (inString(" ",sub(Str1,max(1,min(64,(B-1)8+A)),1),1))not((A>8)+(A<1)+(B>8)+(B<1))sum(G={24,25,26,34
                     21->G
                     While (G=21)+(G=31
                        Output(2,14,max(1,M
                        Output(3,15,R
                        Repeat Ans
                        getKey:End
                        Ans->G
                        1+(G=21 xor M=2->M
                        If Q=1
                        G=31 xor R=1->R
                     End
                     X+M((G=26)-(G=24->A
                     Y+M((G=34)-(G=25->B
                  End
                  Output(Y,X,"
                  A->X:B->Y
                  Output(Y,X,"pi
                  (L6(1)=X)(L6(2)=Y->H
                  0->K
                  If R=1 or Q=0:Then
                     Repeat K=0
                        L6(1->S
                        L6(2->T
                        If randInt(0,1
                        Then
                           max(1,min(8,randInt(1,L6(4))((L6(1)<X)-(L6(1)>X))+L6(1->L6(1
                        Else
                           max(1,min(8,randInt(1,L6(4))((L6(2)<Y)-(L6(2)>Y))+L6(2->L6(2
                        End
                        If inString("O",sub(Str1,(L6(2)-1)8+L6(1),1),1:Then
                           S->L6(1
                           T->L6(2
                        Else
                           Output(T,S,"
                        End
                        If L6(4)=1:not(K->K
                     End
                  Else
                     0->Q
                     0->V
                  End
               End
               If H:Then
                  randInt(1,|LCRAWL(1
                  L6(3)-Ans-Ans(rand10<=2|LCRAWL(13->L6(3
               Else
                  |LCRAWL(2)-iPart(|LCRAWL(12)/3)randInt(1,3*(|LCRAWL(1)-round(|LCRAWL(4)/2,0->|LCRAWL(2
               End
            End
            If |LCRAWL(2)>0:Then
               iPart(randInt(1,1+iPart(iPart(|LCRAWL(12))(1+.5(|LCRAWL(2)=V)-.5(|LCRAWL(2)>V->G
               Asm(prgmTEXTINV
               Output(8,1,"Gained G
               Output(8,9,G
               Output(8,10+int(log(G)),"       
               Asm(prgmTEXTINV
               G+|LCRAWL(5->|LCRAWL(5
               Repeat Ans
               getKey:End
            Else
               ClrHome
            For(W,~1000,0:End
               For(S,1,8
                  Output(4,4+S,sub("You Died",S,1
               For(W,~200,0:End
               End
            For(W,~1000,0:End
               ClrHome
            For(W,~500,0:End
               Asm(prgmTEXTINV
               Output(1,1,"    You Died   
               Output(8,1,"Enter To Exit   
               Asm(prgmTEXTINV
               Output(3,1,"                   Thanks for       Playing!                   
               getKey
               Repeat Ans
               getKey:End
               ClrHome
               DelVar Str1DelVar Str2DelVar Str3DelVar Str4DelVar Str5DelVar Str6DelVar L1DelVar L2DelVar L3DelVar L4DelVar L5DelVar L6DelVar |LCRAWL
               [MATHPRINT]
               Stop
            End
            1->U
         End
         .1+[A](L1(2),L1(1->[A](L1(2),L1(1
         1+|LCRAWL(7->|LCRAWL(7
      End
   End
   Repeat V=0
      0->V
      Repeat (A>8)+(A<1)+(B>8)+(B<1)+(G=22
         Output(Y,X,"pi
         Repeat Ans
         getKey:End
         Ans->G
         (G=26)-(G=24)+X->A
         (G=34)-(G=25)+Y->B
         If ((G!=22)not((A>8)+(A<1)+(B>8)+(B<1:Then
            If inString(" ",sub(Str1,(B-1)8+A,1),1:Then
               Output(Y,X,sub(Str1,(Y-1)8+X,1
               A->X:B->Y
         End:End
      End
      0->U
      If G=22:Then
         1->V
         "resume save   char   quit                               RESUME SAVE   CHAR   QUIT                               ->Str4
         For(W,0,7
            Output(W+1,10,sub(Str4,W7+1,7
         End
         1->S
         Repeat (G=21)+(G=105
            Output(S,10,sub(Str4,(S+7)7+1,7
            Repeat Ans
            getKey:End
            Ans->G
            Output(S,10,sub(Str4,(S-1)7+1,7
            max(1,min(4,(G=34)-(G=25)+S->S
         End
         If S=4:Then
            ClrHome
            For(W,0,1
               Output(8,1,"Saving..\.       
               Asm(prgmTEXTINV
            End
            L1(1->|LCRAWL(8
            L1(2->|LCRAWL(9
            X->|LCRAWL(10
            Y->|LCRAWL(11
            For(N,1,8
               For(O,1,7
                  [A](N,O->|LCRAWL((N-1)7+O+14
               End
            End
            DelVar Str1DelVar Str2DelVar Str3DelVar Str4DelVar Str5DelVar Str6DelVar L1DelVar L2DelVar L3DelVar L4DelVar L5DelVar L6DelVar [A]
            1->|LCRAWL(14
            ClrHome
            [MATHPRINT]
            Stop
         End
         If S=2:Then
            For(W,0,1
               Output(8,1,"Saving..\.       
               Asm(prgmTEXTINV
            End
            L1(1->|LCRAWL(8
            L1(2->|LCRAWL(9
            X->|LCRAWL(10
            Y->|LCRAWL(11
            For(N,1,8
               For(O,1,7
                  [A](N,O->|LCRAWL((N-1)7+O+14
               End
            End
         End
         If S=3:Then
            ClrHome
            0->U
            1->S
            While U>=0
               If U=0
               "upgrades        force reset     back            UPGRADES        FORCE RESET     BACK            "->Str4
               If U=1
               "health          damage          gold gain       armor           crit chance     back            HEALTH          DAMAGE          GOLD GAIN       ARMOR           CRIT CHANCE     BACK            "->Str4
               If U=2
               "yes             no              YES             NO              "->Str4
               Output(1,1,"                                                                ----------------
               Output(1,1,sub(Str4,1,min(64,length(Str4)/2
               1->N
               Repeat U!=1
                  
                  {2,2+|LCRAWL(4),3,1,3+|LCRAWL(12)+|LCRAWL(4),1,12,6+|LCRAWL(12),1,4,4+|LCRAWL(12)+|LCRAWL(1),1,13,3+|LCRAWL(12),.1->L6
                  Output(6,1,"G               "
                  Output(6,2,|LCRAWL(5
                  Repeat (G=21)+(G=105
                     If U=0:Then
                        Output(7,1,"HP              Progress       
                        Output(7,4,|LCRAWL(2
                        Output(8,10,round(100(|LCRAWL(7)/|LCRAWL(6)),0)
                     Else
                        If U=1:Then
                           If U(S+N-1<length(Str4)/32:Then
                              Output(7,1,"Amount          Cost           
                              3(S+N-1
                              Output(7,8,|LCRAWL(L6(Ans-2
                              Output(8,6,L6(Ans-1
                           Else
                              Output(7,1,"                                "
                           End
                        Else
                           Output(6,1,"Are you sure?                                   
                        End
                     End
                     Output(S,1,sub(Str4,(S+N+(length(Str4)/32)-2)16+1,16
                     Repeat Ans
                     getKey:End
                     Ans->G
                     (G=34)-(G=25)+S->T
                     If U((T>4)+(T<1:Then
                        max(1,min((length(Str4)/32)-3,(T>4)-(T<1)+N->N
                     End
                     Output(1,1,sub(Str4,(N-1)16+1,min(64,length(Str4)/2
                     max(1,min(min(4,iPart(length(Str4)/32)),T->S
                  End
                  U->J
                  If S+N-1<length(Str4)/32:Then
                     If U=1:Then
                        3(S+N-1->R
                        If |LCRAWL(5)>=L6(Ans-1:Then
                           |LCRAWL(L6(Ans-2))+L6(Ans->|LCRAWL(L6(Ans-2
                           |LCRAWL(5)-L6(R-1->|LCRAWL(5
                        End
                     End
                     If U=2:Then
                        ClrHome
                        Goto 3
                     End
                  End
                  If U(S+N-1=length(Str4)/32:0->U
               End
               If (S=1)(J=2
               Goto 3
               If (S>3)(J=1
               1->S
               If J=0:S->U
               If (S=3)(J=0
               ~1->U
            End
         End
         Output(1,1,Str3
         Output(L1(2),L1(1)+9,"plotsquare
         1->V
      End
   End
   9+(L1(2)-1)16+L1(1->S
   iPart([A](L1(2),L1(1
   1+min(1,Ans)+sum(Ans={12,13,14,15->T
   sub(Str3,1,S-1)+sub(" plotdotplotcross",T,1)
   If not(S=128
   Ans+sub(Str3,S+1,length(Str3)-S
   Ans->Str3
   L1+{(A>8)-(A<1),(B>8)-(B<1->L1
   X-7(A>8)+7(A<1->X
   Y-7(B>8)+7(B<1->Y
End
ClrHome
For(W,~500,0:End
For(L,1,8
   Output(1,5,sub("Victory!",1,L
For(W,~200,0:End:End
For(W,~500,0:End
Output(2,1,"Press Any Key toContinue                        Press Enter to  Quit and\ Reset")
Asm(prgmTEXTINV
Output(1,1,"    Victory!    ")
Output(4,1,"       or\       ")
Output(8,1,"v1.5.0          ")
Asm(prgmTEXTINV
getKey
Repeat Ans
getKey:End
Ans->G
ClrHome
0->|LCRAWL(14)
1->M
If not(G=105:Goto 1
Lbl 3
DelVar Str1DelVar Str2DelVar Str3DelVar Str4DelVar Str5DelVar Str6DelVar L1DelVar L2DelVar L3DelVar L4DelVar L5DelVar L6DelVar |LCRAWLDelVar [A]
[MATHPRINT]
ClrHome
If this is only for the monochrome seris then use basic builder. If u want, keep the regular one as well if this programs works on the CE as it will have more ram and speed. Although this isn't really much of an optimization. 🙂
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement