(note: the code takes a binary number in a list (that list is Ans) and outputs the decimal equivalent. for example, 101_{2} is {1,0,1}.)

`4ֿ¹sum(seq(Ans(1+dim(Ans)-A)2(2^A),A,1,dim(Ans`

`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`

For some reason I have not been able to make it work on the TI calculator I have, I blame my meds. Could some one implement it so that it shows the random version in action?

]]>`ClrHome {11,28}→dim([A]) For(A,2,10) For (B,2,27) max(0,randInt(⁻3,1))→[A](A,B) Output(A,B-1),"O") End:End 0→G Output(1,1,"GENERATION") Output(1,16,"MEMBERS=") Repeat getKey or M=0 G+1→G For(A,2,10) For(B,1,26) Output(A,B,sub(" O",[A](A,B+1)+1,1)) End:End Output(1,12,G) Output(1,24," ") //four spaces [A]→[B] 0→M For(A,2,10) For(B,2,27) Output(A,B-1,"θ") If [A](A,B)=1:M+1→M Output(1,24,M) 0→N For(C,-1,1) For(D,-1,1) If [A](A+C,B+D) and 2≠sum(not({C,D}≠0)):N+1→N End:End If N=3 and [A](A,B)=0 1→[B](A,B) If [A](A,B)=1 and N≠2 and N≠3 0→[B](A,B) Output(A,B-1,sub(" O",[A](A,B)+1,1)) End:End [B]→[A] End`

]]>
`ClrHome:ClrDraw 38→A:24→B:8→N:1→M randInt(0,A-1,N)→⸤SEEDX randInt(0,B-1,N)→⸤SEEDY {11,15,19,14,10,13,23,22,21,20}→⸤COLOR 0→R "√((⸤SEEDX(I)-K)²+(⸤SEEDY(I)-L)²"→u For(K,0,A) For(L,0,B) N→dim(⸤DISTS) For(I,1,N) u→⸤DISTS(I) End SortA(⸤DISTS) If ⸤DISTS(M)>R ⸤DISTS(M)→R End:End For(K,0,A) For(L,0,B) For(I,1,N) u→⸤DISTS(I) End SortA(⸤DISTS) ⸤COLOR(max(1,(min,23,int(round(10*⸤DISTS(M)/R,0)))))→C Pt-On(K,L,C) Pt-On(K,L,2,C) End:End For(I,1,N) Pt-On(⸤SEEDX(I),⸤SEEDY(I),BLACK) Pt-On(⸤SEEDX(I),⸤SEEDY(I),2,BLACK) End`

I've tried to optimize it as much as possible, and here is the program so far:

Note: → is represented as [->] , small E is represented as slash e slash , ≤ is represented as [<=] and ≠ is represented as [!=]

`prgmTITIMER1 //Generates notation string "F'F F2B'BB2R'R R2L'LL2U'UU2D'DD2 -> Str1 //Asks what character you want around the border, and if length is not 1, repeats the action Lbl 0 Prompt Str3 If 1!=length(Str3 Goto 0 //Draws border For(X,1,16 For(Y,1,8 If X=1 or X=16 or Y=1 or Y=8 Output(Y,X,Str3 End:End //Starts a Loop for E, which at the end of the code will put the final time at the 'E'th part of L₆ DelVarDFor(E,1,/e/9 //Generates scramble For(C,2,5 2->B //This part of scramble generating doesn't use a For( loop because that will mean gaps in the scramble, see near end of While loop While B<=14 randInt(1,18->A //This part prevents redundancy If int(A/6)=int(D/6 Goto 1 Output(C,B,sub(Str1,2A-1,2 A->D B+2->B Lbl 1 End:End Output(7,2,"Press [Enter]. Pause For(C,2,7 Output(C,2," //14 spaces End Output(4,9,0 Pause //Actual timer (the timing system isn't entirely accurate, but I wanted to save information on the increment level, and it's only off by ~1 second every 5 minutes.) For(A,1,/e/9,.022 Output(4,5,A If getKey: Goto 2 End Lbl 2 A->L₆(E Pause End`

For now, all you need to know to help with this program is that there is a line of cells across the top, and each one is either on or off. When it advances to the next generation of cells (drawn in on the next line), it changes one cell's state based on the cell to the left and the cell to the right. Because of this, the program has to check each cell in the row to determine if it should stay on, stay off, or change state. I am hoping there is a faster way to do this, since right now it takes a very long time to draw an entire screen.

W is the width of the screen that the calculator is drawing on (and it is centered at 132, the middle of the screen for a TI 84 CE)

Str1 is an 8 digit string of zeroes and ones. The calculator determines how a cell should change by checking the cell and its left and right neighbor and turning that into a number 1-8 (because there are 8 different states the 3 cells could be in). The number corresponds to a digit in Str1 and determines if that cell should be on or off. Str1 can be changed to show any of the rules for cellular automata.

`For(Y,0,163) For(X,132-W/2,132+W/2) If expr(sub(Str1,8-4(pxl-Test(Y,X-1))-2(pxl-Test(Y,X))-pxl-Test(Y,X+1),1 Pxl-On(Y+1,X End End`

There are online programs that can do this in a matter of seconds. Is there a way I can make this loop run faster? I have tried referencing a list of 8 numbers instead of a string, but it didn't appear to run faster. I'm hoping there is something that I have missed, but it's possible that a calculator just can't run any faster. If you have any ideas of how to speed this up, I would greatly appreciate it!

]]>`:Prompt A :For (I,1,1+int(√(A))) //In this case, I know I am losing 3 bytes. This is the only case where I am factoring for speed, since leaving the parentheses here off will slow it down 20x. :If not(fPart(A/I //Using remainder( is faster, (I think), but it's a byte more, and I don't care enough about the tiny speed loss. :Then :Disp I :Pause A/I :End :End`

I'm asking because I don't see any other optimizations. And to think that this used to be 120 bytes!

]]>This code essentially draws 2 boxes: One, with opposite vertices of (18,-18) and (29,-29), is for the user. A small cross (I used Pt-On for this) is moved around by the arrow keys, and is prevented from leaving the square. The square is 10x10, but the movement area is 8x8, so that the cross cannot erase any of the square.

The second box has opposite vertices of (38,-18) and (49,-29), and is for the image. When the user presses "Enter," the pixel in the Image box corresponding to the position of the user in the User box changes color. So you move the user in the user box, then press Enter to change around how the Image box looks. This is solely so that the image isn't screwed up by having the user pointer in it. The Image Box also is 10x10, so that even if the entire 8x8 sprite is filled, there is a layer of white pixels between the box outlines and the sprite.

`Recall GDB0 //See note below on GDB0 DispGraph 18→X 29→Y Line(X,-X,X,-Y //This entire mess of code is to draw the 2 box outlines. Line(X,-X,Y,-X Line(Y,-Y,X,-Y Line(Y,-Y,Y,-X 38→I 49→J Line(I,-X,J,-X Line(I,-X,I,-Y Line(J,-Y,I,-Y Line(J,-Y,J,-X 0→K //Keypress Tester 20→X -20→Y Pt-On(X,Y,3 Repeat K=22 //This main loop gets exited out when the user presses "Mode" Repeat Ans getKey //Waits for a keypress End Ans→K Pt-Off(X,Y,3 //Erases the user pointer max(20,min(27,X=sum(ΔList(K={24,26→X //Change X and Y coords max(-27,min(-20,Y+sum(ΔList(K={34,25→Y Pt-On(X,Y,3 //Redraw User Pointer If K=105 //If you press Enter, change the Image Square pixel Pxl-Change(-Y,20+X If K=23:Then //If you press Del, clear the Image box For(I,40,47 For(J,20,27 Pxl-Off(J,I End:End:End If K=45 //If Clear is pressed, end the Program Return End //When Mode is pressed, the main loop terminates, and the to-hex part begins "?→Str1 For(I,0,15 //Repeat for all 16 4-by-1 "segments" of the image, each of which is 1 character. remainder(I,2→J //Calculate if this segment is on the right or left side of the image 20+(I-J)/2→K //Figure out which row of the image this segment is on 0 //Reset Ans For(X,3,0,-1 Ans+2^X*pxl-Test(K,40+4J+3-X //Each time it loops through, it reads a new pixel in the segment, and adds it on to Ans. So 1110 translates to 8=8, 8+4=12, 12+2=14, so the value output at the end of this loop is 14. End sub("0123456789ABCDEF",Ans+1,1 //Translates the decimal value into a hex value Str1+Ans→Str1 //Adds the letter (which is the hex value of that segment) onto Str1 End sub(Str1,2,length(Str1)-1→Str1 //Gets rid of the "?" at the beginning of Str1 Ans`

Note on GDB0:

This is here so that all of the graph settings get set so that Xmin=0, Xmax=94, Ymin=-62, Ymax=0 (so that every pixel has its own coordinates, making the Pxl-On( and Pt-On( interchangeable, and to improve usage with the Line(Command

Note on what I mean by "Segments:"

An 8x8 sprite outputs a 16-character hex string. Each set of 4 pixels in a row translates to half a byte, or one of those characters. So the string of pixels 1101 would translate to the hex character D. I call each of these segments "segments" (I think the proper term is actually nibbles, but I'm not sure.) There are 2 segments per row of the sprite, and 8 rows of the image, which makes the 16 segments.

`:Lbl Y :Clrhome :AxesOff :ZStandard :ZSquare :Vertical 4 :Vertical -4 :Line(-11,3.7,11,3.7 :Line(-11,-3.7,11,-3.7 :0→T :0→G :0→H :DelVar [A]{3,3→dim([A] :Repeat T=9 :0→A :Repeat A>7.1 and A<9.5 :.1getKey→A :If A=1.1 :Goto A :End :10fPart(A)-1→C :iPart(A)-6→D :If [A](D,C)=0 :Then :T+1→T :7.5C-15→X :-7D+14→Y :If fPart(T/2 :Then :Line(X-2,Y-2,X+2,Y+2,18 :Line(X-2,Y+2,X+2,Y-2,18 :→[A](D,C :Else :Circle(X, Y, 2, 15 :-1→[A](D, C :End :If T>4 :Then :If abs([A](1,C)+[A](2,C)+[A](3,C))=3 :Then :Line(X,8,X,-8,11 :1→H :End :If abs([A](D,1)+[A](D,2)+[A](D,3))=3 :Then :Line(-8.5,Y,8.5,Y,11 :1→H :End :If abs([A](2,2))=1 :Then :If abs([A](1,1)+[A](2,2)+[A](3,3))=3 :Then :Line(-7.5,7,7.5,-7,11 :1→H :End :If abs([A](3,1)+[A](2,2)+[A](1,3))=3 :Then :Line(-7.5,-7,7.5,7,11 :1→H :End :End :If H :Then :Text(-1,10,10,sub("XO",(fPart(T/2)=0)+1,1)+" WINS!!! :9→T :Pause :End :End :End :End :Lbl A :Menu("PLAY AGAIN?","YES",Y,"NO",N :Lbl N :ClrDraw :ClrHome :"`

I opted for a nicer-looking program (at least in my opinion), though it does result in it being larger ]]>

`PROGRAM:XROOTOFθ :ClrHome :Disp "ˣ√θ :Prompt X,θ :round(Xˣ√θ,0→N :If not(N :Return :While fPart(θ/N^X :DS<(N,2 :End :ClrHome :Disp "Nˣ√θ","N=",N,"θ= :θ/N^X→θ`

Just in case anyone was wondering about the last line's "→θ", that's so it actually stores θ as θ in case the user wants to use θ later ]]>

:D

Here's the plaintext:

`15→A 100→B 0→C 1100→ D 12000→E 130000→F 1400000→G 0→H C→M 0→P Lbl 1 0→Z ClrDraw While Z65 //(This will keep happening until “M” is pressed, then it will show the heavenly cookies / prestige option.This will come up later.) C+P→C M+P→M //This gives 1 second (or frame, more exactly) of cookies to C, the cookie indicator, and gives it to M, the “This Prestige” cookies made all time marker (It’s reset when prestige is bought, but until then, it just increases with cookies) Text(0,1,”COOKIES:” Text(0,32,int(C Text(0,60,”CPS:” Text(10,75,int(P*10)/10 getKey→Z //(Z is the variable used for all getKey purposes, and checks once every frame to see what button was pressed since the previous check. It gets slower once the framerate gets slower, typically later in the game, as their speeds are about the same.) If Z=53 or Z=83 Then C+max(1,int(P/100)→C M+max(1,int(P/100)→M End //The above If-Then statement basically states that if you press 5 or cos( , then it will give you one cookie or 1/100 of your CPS, or cookies per second, whichever is greater. Text(8,1,”ITEM: Text(9,40,”COST Text(9,75,”CPS //For all you perfectionists out there (no offense), I have it so the “ITEM:” figure is slightly higher than the others so if someone takes the idea, they can have them all at the same level or at different levels, but they cannot do exactly what I did. Text(16,1,”CURSOR Text(22,1,”GRANDMA Text(28,1,”FARM Text(34,1,”MINE Text(40,1,”FACTORY Text(46,1,”BANK //That was the item display code... Text(16,40,A Text(22,40,B Text(28,40,D Text(34,40,E Text(40,40,F Text(46,40,G //That was the price display code… Text(16,75,int(0.1(1.01^H)*10/10 //This is the only CPS block that has a decimal, as it represents the cursor. Text(22,75,int(1(1.01^H)) Text(28,75,int(8(1.01^H)) Text(34,75,int(40(1.01^H)) Text(40,75,int(250(1.01^H)) Text(46,75,int(1000(1.01^H)) //Those were the CPS per item blocks, by the way. If Z=11 and C>=A Then C-A→C int(1.2A→A P+0.1(1.01^H)→P ClrDraw End //That was basically saying if the Y= button was pressed it would buy a cursor, increase cursor price by 20%, and add Cursor CPS to P, the CPS marker. If Z=12 and C>=B Then C-B→C int(1.2B→B P+1(1.01^H)→P ClrDraw End //It’s basically the same with all the other buildings, but with Window, Zoom, Trace, Graph, and Up. If Z=13 and C>=D Then C-D→C int(1.2D→D P+8(1.01^H)→P ClrDraw End If Z=14 and C>=E Then C-E→C int(1.2E→E P+40(1.01^H)→P ClrDraw End If Z=15 and C>=F Then C-F C int(1.2F F P+250(1.01^H)→P ClrDraw End If Z=25 and C>=G Then C-G→C int(1.2G→G P+1000(1.01^H)→P ClrDraw End End //(If this is gotten to, then it shows prestige.) ClrDraw Text(1,1,”RESET NOW AND GET” Text(20,1,”HEAVENLY CHIPS?” //That was all the static prestige elements before the Menu( element. Text(10,6,int(.01\sqrt\M))) //If you don’t know already, the \sqrt\ is just a square root symbol. Pause Menu(“RESET?”,”YES”,A,”NO”,B Lbl B Goto 1 Lbl A 15→A 100→B 0→C 1100→D 12000→E 130000→F 1400000→G 0→P H+int(0.01√(M)))→H 0 M ClrDraw Goto 1`

//And that’s it! Please let me know if you have any suggestions for making it faster! Your input is appreciated! ]]>

`:ClrHome :Disp “PASSWORD” :Input “1=”,A :Input “2=”,B :Input “3=”,C :Input “4=”,D ((A+B)*C)*D￫P :If P=18 :Then :Disp “Right” :Else :Disp “Wrong” :End`

]]>
`ClrHome 1→dim(L₁ 1→dim(L₂ For(Y,0,164 For(X,0,264 If pxl-Test(Y,X Then augment(L₁,{X→L₁ augment(L₂,{Y→L₂ End End End ClrDraw For(X,2,dim(L₁ Pxl-On(L₂(X),L₁(X),BLACK End`

`:DelVar L₁1→C :Input A :For(B,1,A :A/B→L₁(C:C+not(fPart(Ans→C :End:L₁`

Small Piece of the game:

`If M=0002 Then ClrHome Output(1,1,"TEST MAP 2" Pause ClrHome 200->G 5->X 6->Y 1->S While 1 Repeat I getKey->I Output(Y,X,"X" If I=24 Then ClrHome X-1->X End If I=25 Then ClrHome Y-1->Y End If I=26 Then ClrHome X+1->X End If I=34 Then ClrHome Y+1->Y End If S=1 Then Output(1,1,"TTTTTTTTTTTTTTTT" Output(8,1,"TTTTTTTTTTTTTTTT" End If S=2 Then Output(3,4,"III" End If Y=1 and S=1 //Collision Detection Then If X=1 Then 2->Y End If X=2 Then 2->Y End If X=3 Then 2->Y End If X=4 Then 2->Y End If X=5 Then 2->Y End If X=6 Then 2->Y End If X=7 Then 2->Y End If X=8 Then 2->Y End If X=9 Then 2->Y End If X=10 Then 2->Y End If X=11 Then 2->Y End If X=12 Then 2->Y End If X=13 Then 2->Y End If X=14 Then 2->Y End If X=15 Then 2->Y End If X=16 Then 2->Y End End End End End`

`... int main() { printf("Hello World\n"); printf("Hello World\n"); printf("I'm still here dawg\n"); return 0; }`

Note: Due to specifics of the random number generating algorithm, the smallest number possible to generate is slightly greater than 0. The largest number possible is actually 1, but since returning a result of 1 would mess up the output of randBin( and randNorm(, the actual value returned in such cases is 1-1.11e-12 (which is displayed as 1, and is "equal" to 1 for the purposes of the = command). To see 1, store 196164532 to rand and then run the random number generator.

I'm a little confused about this statement since the output of rand is not used as the next value to compute rand since seeds are rounded down to an integer. Regardless, it and CloudVariable's post inspired me to write this code.

**It's purpose is to record values of rand(and their seeds) that are greater than their predecessor's value.**

Here is the uncommented version if you want to run the program.

Obviously I'm looking for optimizations, but let me know if you think I have a bug anywhere as well.

This program is essentially a brute force approach to finding the values I want, I'm interested in analyzing the algorithm as well, but as of now I don't understand how to do that.

**I.E. is it possible to algebraically solve for seed values that output values close to 1, equal to 1, or the value closest to 0?**

`:Lbl 10 :ClrHome :Menu("UNIT CIRCLE","CONVERSIONS",11,"UNIT CIRCLE",3,"QUIT",4) :Lbl 11 :ClrHome :Menu("CONVERSIONS","DEGREES -> RADIANS",1,"RADIANS -> DEGREES",2,"BACK",10) :Lbl 1 :Input "DEGREE MEASURE: ",D :Radian :Disp Dº :Pause :Goto 11 :Lbl 2 :Input "RADIAN MEASURE :",R :Degree :Disp R^^r^^ :Pause :Goto 11 :Lbl 3 :ClrHome :Menu("UNIT CIRCLE FUNCTIONS","ANGLE FROM DEGREE",5,"ANGLE FROM RADIAN",6,"ANGLE FROM COORDINATE",7,"BACK",10) :Lbl 5 :Input "DEGREE MEASURE: ",A :Degree :Goto 9 :Lbl 6 :Input "RADIAN MEASURE: ",A :Radian :Goto 9 :Lbl 7 :Input "X=",X :Input "Y=",Y :Degree :R▶Pθ(X,Y)→A :Lbl 9 :StoreGDB 1 :ClrDraw :AxesOff :ZStandard :ZSquare :Horizontal 0,BLACK :Vertical 0,BLACK :Circle(0,0,9,BLUE) :Line(0,0,P▶Rx(9,A),P▶Ry(9,A),RED) :Pause :RecallGDB 1 :Goto 3 :Lbl 4 :Stop`

-or-

A bit of explanation on confusing parts:

C is the actual selected square, or the **choice** the player made

P is the highlighted **position** on the gameboard

C and P should be the same 90% of the time, but I used 2 variables because thats just how I did it (deal with it)

2 | 3 | 5 |

7 | 11 | 13 |

17 | 19 | 23 |

By using the first 9 primes, each row column and diagonal will multiply together to a unique product (30, 1001, 7429, 238, 627, 1495, 506, or 935). I take the positions already played (as their corresponding primes), and take the product. If the product is divisible by any of the 8 unique prime products with no remainder, then it means that somebody has won.

]]>