After recently finding one of my old calculators (I had two 83+'s for the longest time, but lost one) I have stumbled upon what was the best program I had made, 4 years into programming. Mind you up to just after this point I had almost zero experience online (tutorials, guides, or even contact with almost any other programmer), and a few weeks/months after making this project, I found my home forums: DevHardware.

Here is my once prized program, TICTACTO: (WARNING: This code was made before I knew the term "optimization" or how to "optimize" code. The file is absolutely massive, and iirc, is about 8-12 KB. Also, it was severely corrupted, so some of it may not work properly, and you may run into syntax errors. I tried taking out anything that was corrupted, but let me know if you find anything that looks like it wouldn't work. Lastly, this whole code was de-token-ized by Merth's TokensIDE, so ignore the "" breaks)

Code:
6->dim(listSCOR
ClrHome
Goto 9
Lbl 8
ClrHome
Disp "IS THIS YOUR","FIRST TIME","PLAYING TIC-TAC-","TOE?","(Y/N)
getKey->G
Repeat G=92 or G=71
getKey->G
End
ClrHome
If G=92:Goto 1
Goto AA
Lbl 9
Output(1,3,"Tic-Tac-Toe"
Output(2,6,"V-1.6"
Output(4,1,"Best on TI-84+SE"
Output(8,4,"Loading..."
Output(6,5,"Made By:"
Output(7,3,"Joey McNamara"
rand(1
If listSCOR(6)=0:Goto 8
Goto AA
Lbl AA
ClrHome
1->listSCOR(6)
Menu("Tic-Tac-Toe","One Player",C,"T\wo Player",B,"Reset Scores",R1,"Q\uit",NO,"Help",1
Lbl 1
ClrHome
Disp "To play Tic-Tac-","Toe, yo\u \use the","Up, Do\wn, Left, ","and Right arro\ws","to mo\vdotPlotmin( yo\ur    ","c\urrent position","seen by thE 4 *s"
Output(8,1,"aro\und the grid."
Pause
ClrHome
Disp "Yo\u can also \use","the n\umbers 1-9 ","like a grid to  ","j\ump to yo\ur    ","desired position","q\uickly.        "
Pause
ClrHome
Disp "The n\umbers and ","letters next to ","the grid sho\w   ","yo\ur scores.    "
Pause
ClrHome
Disp "X-X's \wins      ","O-O's \wins      ","0-0's \wins      ","theta-theta's \wins      ","D-Dra\ws         "
Pause
ClrHome
Disp "X is either yo\u ","or \whoe\ver \used ","X at th[phat1]time.  ","O is the second ","player \used only","d\uring T\wo      ","Players mode    "
Pause
ClrHome
Disp "0 is any One    ","Player mode comp","other than the  ","Impossible comp.","theta is the        ","Impossible mode ","comp\uter's \wins."
Pause
ClrHome
Disp "In easy mode,   ","the comp\uter    ","\will only do    ","randomly        ","generated points"
Pause
ClrHome
Disp "In Normal mode, ","the comp\uter    ","\will act only on","defense, and    ","\will not \win    ","on p\urpose, b\ut ","may on accident "
Output(8,1,"or self-defense."
Pause
ClrHome
Disp "In Hard mode,   ","the comp\uter    ","\will act on the ","defense and     ","offense, and    ","\will take any   ","chance gi\ven to "
Output(8,1,"\win.            "
Pause
ClrHome
Disp "Impossible mode ","is named s\uch   ","for a reason.   ","It is not       ","possible to \win ","against the comp","\when it is in   "
Output(8,1,"this mode.      "
Pause
ClrHome
Disp "Yo\u \will no\w    ","ret\urn to the   ","main men\u.      ","Good l\uck, ha\ve ","f\un, and try not","to lose too many","times!          "
Output(8,1,"      -Joey Mac "
Pause
ClrHome
Goto AA
Lbl R1
Menu("Are yo\u s\ure?","No",AA,"Yes",R
Lbl C
Menu("Pick Diffic\ulty","Easy",E,"Normal",N,"Hard",H,"Impossible",IM,"Back",AA
Lbl E
1->A
Goto I
Lbl N
2->A
Goto I
Lbl H
3->A
Goto I
Lbl IM
4->A
Goto I
Lbl B
DelVar A
Goto I
Lbl R
For(U,1,5
0->listSCOR(U)
End
Goto AA
Lbl I
ClrHome
DelVar M
Disp " *      X","* ! ! * O"," -+-+-  0","  ! !   theta"," -+-+-  D","  ! ! "," *"
For(U,1,5
If listSCOR(U)<=9999999 and listSCOR(U)>=0:Then
Output(U,10,listSCOR(U)
Else
Output(U,10,"ERROR"
End
End
" "->Str1
Str1->Str2
Str2->Str3
Str3->Str4
Str4->Str5
Str5->Str6
Str6->Str7
Str7->Str8
Str8->Str9
2->X
2->Y
DelVar R
DelVar Q
Goto I1
Lbl I1
While 1
If Q=0:Then
If ((A=1 or A=2 or A=3) and int(M/2)!=M/2) or ((A=4 or A=5) and int(M/2)=M/2):Goto I4
DelVar G
"X"->Str0
If int(M/2)!=M/2 and A!=4 and A!=5:"O"->Str0
Output(1,1,Str0
Output(1,7,Str0
Output(7,1,Str0
Output(7,7,Str0
getKey->G
While not(G=24 or G=25 or G=26 or G=34 or G=23 or G=72 or G=73 or G=74 or G=82 or G=83 or G=84 or G=92 or G=93 or G=94 or G=105
getKey->G
End
G->R
X->S
Y->T
If G=23:Goto NO
If int(G/10)>=7 and int(G/10)<=9:int(G/10)*2-12->X
If G-10int(G/10)>=2 and G-10int(G/10)<=4 and int(G/10)>3:2G-20int(G/10)-2->Y
If G=105:Then
If X=2:Then
If Y=2 and Str1=" ":Then
M+1->M
Str0->Str1
Output(2,2,Str1
End
If Y=4 and Str2=" ":Then
M+1->M
Str0->Str2
Output(2,4,Str2
End
If Y=6 and Str3=" ":Then
M+1->M
Str0->Str3
Output(2,6,Str3
End
End
If X=4:Then
If Y=2 and Str4=" ":Then
M+1->M
Str0->Str4
Output(4,2,Str4
End
If Y=4 and Str5=" ":Then
M+1->M
Str0->Str5
Output(4,4,Str5
End
If Y=6 and Str6=" ":Then
M+1->M
Str0->Str6
Output(4,6,Str6
End
End
If X=6:Then
If Y=2 and Str7=" ":Then
M+1->M
Str0->Str7
Output(6,2,Str7
End
If Y=4 and Str8=" ":Then
M+1->M
Str0->Str8
Output(6,4,Str8
End
If Y=6 and Str9=" ":Then
M+1->M
Str0->Str9
Output(6,6,Str9
End
End
End
If G=24 and Y!=2:Y-2->Y
If G=25 and X!=2:X-2->X
If G=26 and Y!=6:Y+2->Y
If G=34 and X!=6:X+2->X
If S!=X or T!=Y:Then
Output(S,1,"
Output(S,7,"
Output(1,T,"
Output(7,T,"
Output(X,1,"*
Output(X,7,"*
Output(1,Y,"*
Output(7,Y,"*
End
End
If M>4:Then
If (Str1!=" " and Str1=Str2 and Str2=Str3) or (Str1!=" " and Str1=Str5 and Str5=Str9) or (Str1!=" " and Str1=Str4 and Str4=Str7) or (Str2!=" " and Str2=Str5 and Str5=Str8) or (Str3!=" " and Str3=Str5 and Str5=Str7) or (Str3!=" " and Str3=Str6 and Str6=Str9) or (Str4!=" " and Str4=Str5 and Str5=Str6) or (Str7!=" " and Str7=Str8 and Str8=Str9):Then
Output(6,10,"PRESS
Output(7,9,"[ENTER]
Pause
ClrHome
Disp Str0
Output(1,3,"WINS!
If Str0="0" or Str0="theta":Output(1,7,"...
listSCOR(1)+(Str0="X")->listSCOR(1)
listSCOR(2)+(Str0="O")->listSCOR(2)
listSCOR(3)+(Str0="0")->listSCOR(3)
listSCOR(4)+(Str0="theta")->listSCOR(4)
Goto RS
End
If M=9:Then
Output(6,10,"PRESS
Output(7,9,"[ENTER]
Pause
ClrHome
Disp "DRAW...
1+listSCOR(5)->listSCOR(5)
Goto RS
End
End
DelVar Q
If A!=0 and A!=4 and A!=5 and (M=1 or M=3 or M=5 or M=7 or M=9):Goto I4
End
Lbl I4
"0"->Str0
If A=4 or A=5:"theta"->Str0
Output(1,1,Str0
Output(1,7,Str0
Output(7,1,Str0
Output(7,7,Str0
M+1->M
Output(8,1,"Loading..."
If not(M=2 or A=1):Then
0->Z
If Str1=" " and (Str3="X" and Str2="X" or Str7="X" and Str4="X" or Str9="X" and Str5="X"):1->Z
If Str2=" " and (Str1="X" and Str3="X" or Str8="X" and Str5="X"):2->Z
If Str3=" " and (Str1="X" and Str2="X" or Str7="X" and Str5="X" or Str9="X" and Str6="X"):3->Z
If Str4=" " and (Str1="X" and Str7="X" or Str5="X" and Str6="X"):4->Z
If Str5=" " and (Str1="X" and Str9="X" or Str2="X" and Str8="X" or Str3="X" and Str7="X" or Str4="X" and Str6="X"):5->Z
If Str6=" " and (Str3="X" and Str9="X" or Str4="X" and Str5="X"):6->Z
If Str7=" " and (Str1="X" and Str4="X" or Str3="X" and Str5="X" or Str8="X" and Str9="X"):7->Z
If Str8=" " and (Str2="X" and Str5="X" or Str7="X" and Str9="X"):8->Z
If Str9=" " and (Str1="X" and Str5="X" or Str3="X" and Str6="X" or Str7="X" and Str8="X"):9->Z
If A=2:Then
If Z=0:Goto I5
Goto I6
End
If Str1=" " and (Str3=Str0 and Str2=Str0 or Str7=Str0 and Str4=Str0 or Str9=Str0 and Str5=Str0):1->Z
If Str2=" " and (Str1=Str0 and Str3=Str0 or Str8=Str0 and Str5=Str0):2->Z
If Str3=" " and (Str1=Str0 and Str2=Str0 or Str7=Str0 and Str5=Str0 or Str9=Str0 and Str6=Str0):3->Z
If Str4=" " and (Str1=Str0 and Str7=Str0 or Str5=Str0 and Str6=Str0):4->Z
If Str5=" " and (Str1=Str0 and Str9=Str0 or Str2=Str0 and Str5=Str0 or Str3=Str0 and Str7=Str0 or Str4=Str0 and Str6=Str0):5->Z
If Str6=" " and (Str3=Str0 and Str9=Str0 or Str4=Str0 and Str5=Str0):6->Z
If Str7=" " and (Str1=Str0 and Str4=Str0 or Str3=Str0 and Str5=Str0 or Str8=Str0 and Str9=Str0):7->Z
If Str8=" " and (Str2=Str0 and Str5=Str0 or Str7=Str0 and Str9=Str0):8->Z
If Str9=" " and (Str1=Str0 and Str5=Str0 or Str3=Str0 and Str6=Str0 or Str7=Str0 and Str8=Str0):9->Z
If A=3 or A=5:Then
If Z=0:Goto I5
Goto I6
End
If Str1=" ":1->Z
If M=3:Then
If Str7="X" or Str4="X":2->Z
If Str2="X" or Str3="X":4->Z
If Str8="X" or Str9="X":3->Z
If Str6="X":Then
5->Z
5->A
End
If Str5="X":Then
9->Z
5->A
End
Goto I6
End
If M=5:Then
If (Str2="X" or Str3="X") and Str4="theta" and Str7="X" or (Str4="X" or Str7="X") and Str2="theta" and Str3="X" or Str8="X" and Str3="theta" and Str2="X":5->Z
If Str9="X" and Str3="theta" and Str2="X":7->Z
5->A
Goto I6
End
Goto I6
End
Lbl I5
randInt(1,9)->Z
If (Z=1 and Str1!=" ") or (Z=2 and Str2!=" ") or (Z=3 and Str3!=" ") or (Z=4 and Str4!=" " or (Z=5 and Str5!=" ") or (Z=6 and Str6!=" ") or (Z=7 and Str7!=" ") or (Z=8 and Str8!=" ") or (Z=9 and Str9!=" "):Goto I5
Lbl I6
If Z=1:Then
Str0->Str1
Output(2,2,Str1
End
If Z=2:Then
Str0->Str2
Output(2,4,Str2
End
If Z=3:Then
Str0->Str3
Output(2,6,Str3
End
If Z=4:Then
Str0->Str4
Output(4,2,Str4
End
If Z=5:Then
Str0->Str5
Output(4,4,Str5
End
If Z=6:Then
Str0->Str6
Output(4,6,Str6
End
If Z=7:Then
Str0->Str7
Output(6,2,Str7
End
If Z=8:Then
Str0->Str8
Output(6,4,Str8
End
If Z=9:Then
Str0->Str9
Output(6,6,Str9
End
Output(8,1,"          "
DelVar Q
If M!=2:1->Q
Goto I1
End
Lbl 3
Menu("SAME SETTINGS?","YES, SAME",2,"NO, DIFFERENT",AA
Lbl 2
If A=5:4->A
Goto I
Lbl RS
Output(6,10,"Press"
Output(7,9,"[ENTER]"
Pause
ClrHome
Menu("Play again?","Yes",3,"No",NO
Lbl NO
ClrHome
"Done
Oh, the humanity! Evil or Very Mad


Code:
" "->Str1
Str1->Str2
Str2->Str3
Str3->Str4
Str4->Str5
Str5->Str6
Str6->Str7
Str7->Str8
Str8->Str9
In retrospect, I'm clueless why I thought that strings would be the best plan of action for each cell of the grid. I was just talking to someone (I think it may have been joshie75, but I can't remember) the other day about their TicTacToe program, and that matrices were going to be your best choice, and that I had use strings in mine for reasons beyond me (or at least now).
That looks like a GIANT script for a calculator game =O
MufinMcFlufin wrote:
In retrospect, I'm clueless why I thought that strings would be the best plan of action for each cell of the grid. I was just talking to someone (I think it may have been joshie75, but I can't remember) the other day about their TicTacToe program, and that matrices were going to be your best choice, and that I had use strings in mine for reasons beyond me (or at least now).
Not to mention why you would use that method instead of a single nine-character string if you were so set on strings. I can only assume sub() was a foreign concept to you.
Wow, that's, um, huge. Here's my smallest attempt:

Code:
ClrHome
DelVar [A]
{3,3->dim([A]
For(A,1,16
For(B,1,7,2
Output(B,A,"=
End
End
For(B,1,7
For(A,1,16,5
Output(B,A,"=
End
End
For(C,1,9
Lbl X
3->D
Output(8,1,"XXXXXXXXXXXXXXXX
"XXXX->Str1
If C/2=iPart(C/2
Then
pi->D
"OOOO->Str1
Output(8,1,"OOOOOOOOOOOOOOOO
End
Lbl A
Repeat A
getKey->A
End
iPart(.1A->B
A-(10B+1->A
B-6->B
If A>3 or A<1 or B>3 or B<1
Goto A
If [A](A,B
Goto A
D/3->[A](A,B
Output(2B,5A-3,Str1
0->B
For(A,1,3
If [A](A,1)+[A](A,2)+[A](A,3)=D or D=[A](1,A)+[A](2,A)+[A](3,A
Goto E
B+[A](A,A->B
End
If D=B or D=[A](1,3)+[A](2,2)+[A](3,1
Goto E
End
Output(8,1,"    YOU TIED   
Stop
Lbl E
Output(8,1,"     
Output(8,7," WINS     

Note: This was written 7 years ago, and according to the description I wrote, it's the smallest BASIC TTT out there (this was true at the time).
KermMartian wrote:
MufinMcFlufin wrote:
In retrospect, I'm clueless why I thought that strings would be the best plan of action for each cell of the grid. I was just talking to someone (I think it may have been joshie75, but I can't remember) the other day about their TicTacToe program, and that matrices were going to be your best choice, and that I had use strings in mine for reasons beyond me (or at least now).
Not to mention why you would use that method instead of a single nine-character string if you were so set on strings. I can only assume sub() was a foreign concept to you.
The same was probably true of memory leakage as well.

@Merth
I wanted it to be extensive, and I had little knowledge of how to make things like this smaller, faster, or more efficient. I think that at the time, this little program would have blown my mind.

@ScoutDavid
Indeed it is, and unfortunately, this was not the largest that I had ever made.
Looks to me like it's AI-less, though, no? The versions of TTT that I've written for the calculator have all been player versus calculator with associated AI. Some optimizations:


Code:
"OOOO->Str1
Output(8,1,"OOOOOOOOOOOOOOOO
to
Code:
"OOOO->Str1
Output(8,1,Ans+Ans+Ans+Ans
Remove 17 bytes, add seven bytes; saves ten bytes.

A-(10B+1->A to A-10B-1->A (Save 1 byte)

0->B \ For(A,1,3 to DelVar BFor(A,1,3 (Save 2 bytes)

Save 4 bytes:

Code:
If A>3 or A<1 or B>3 or B<1
Goto A
If [A](A,B
Goto A
to
Code:
If A>3 or A<1 or B>3 or B<1 or [A](A,B
Goto A
KermMartian wrote:
Looks to me like it's AI-less, though, no? The versions of TTT that I've written for the calculator have all been player versus calculator with associated AI. Some optimizations:


Code:
"OOOO->Str1
Output(8,1,"OOOOOOOOOOOOOOOO
to
Code:
"OOOO->Str1
Output(8,1,Ans+Ans+Ans+Ans
Remove 17 bytes, add seven bytes; saves ten bytes.

A-(10B+1->A to A-10B-1->A (Save 1 byte)

0->B \ For(A,1,3 to DelVar BFor(A,1,3 (Save 2 bytes)

Save 4 bytes:

Code:
If A>3 or A<1 or B>3 or B<1
Goto A
If [A](A,B
Goto A
to
Code:
If A>3 or A<1 or B>3 or B<1 or [A](A,B
Goto A
Actually, it has 4 difficulties of AI, including impossible mode. And the last optimizations you did there, I'm pretty sure that I did that to prevent an invalid dimensions error, but that's only a guess. I also remember getting some weird glitches/errors while using DelVar so I always was hesitant to use it. I was probably trying to use a "Delvar BEnd" optimization though, but idk. I also remember at the time describing Ans (word-for-word) as, "...taking a leap-of-faith. You can't be sure about it." I remembered this very well because it's such an absolute contradiction from how I program now.
I believe Kerm was referring to Merthsoft's program, but I only checked one or two of the lines he was optimizing (and only in Merth's program)
_player1537 wrote:
I believe Kerm was referring to Merthsoft's program, but I only checked one or two of the lines he was optimizing (and only in Merth's program)
_player is correct; I was critiquing Merth's code. Also, I see what you mean about the [A](...) conditional; that was indeed necessary as you said.
MufinMcFlufin wrote:
Mind you up to just after this point I had almost zero experience online (tutorials, guides, or even contact with almost any other programmer)

oh man, you have no idea Laughing

my first calc was used and came without that handbook, and i had no experience with any other programming language before starting Ti-Basic. i basically just played around, trying to figure out the syntax, until i was able to approximate the desired function. the first time i looked at a list of basic commands explaining what they did was when searching for an xlib (which i got sans-documentation from a download of one of the metroids) command lists on the ticalc 'programming' page... five months after i started programming Rolling Eyes

i used to do things like this:

:0->L1(A)
:A+1->A
:0->L1(A)
:A+1->A
:0->L1(A)
:A+1->A
:0->L1(A)
:A+1->A
:0->L1(A)
:A+1->A
:0->L1(A)

because i never figured out the purpose of For(
lol thats like me. in my first weeks or so of programing, i had no clue what a loop was, so i would make two programs, the main program, and one that ran that program over and over. also, whenever i wanted to slow something down, for example, display something for a lenghth of time, i would type the same command over and over again, and then still only get half a second of pause time Razz
Awww, poor shmibs and Rhombus. Sad I'm glad you're in our friendly fold now so we can properly direct and chide you and others when they do things like that. Smile
I've also got a Lbl X but no Goto X Wink. Like I said, it was 7 years ago, certainly not perfect. At the time, though, I was quite happy with it Smile
merthsoft wrote:
I've also got a Lbl X but no Goto X Wink. Like I said, it was 7 years ago, certainly not perfect. At the time, though, I was quite happy with it Smile
I'll certainly agree that for code you wrote in your early teens, it's definitely quite commendable.
Ahh, I remember my first progs were clocks on the 86 Razz I had x->x about 50 times, and I could never get rid of the quarter-second delay you got when it updated the minutes Razz

Almost directly after that I found out what for( was for, and after that I found while(I had been using ifs and gotos XD)
willrandship wrote:
Ahh, I remember my first progs were clocks on the 86 Razz I had x->x about 50 times, and I could never get rid of the quarter-second delay you got when it updated the minutes Razz

Almost directly after that I found out what for( was for, and after that I found while(I had been using ifs and gotos XD)
Haha, very nice. Smile I suppose it's a tribute to an individual's aptitude for programming when he or she writes alternatives to correct commands that he or she doesn't know, though. Smile
I guess. I'm still not that good. Razz Let's just say that if I took a course in Axe, it would be 101 Razz
Oh man, I remember one of my first programs was a short "movie" showing a pixel falling (linearly of course, no real physics) and then exploding like a nuke.

I didn't know For loops exists so I painstakingly wrote:


Code:

Pxl-On(0,47)
Px-Off(0,47)
Pxl-On(1,47)
Px-Off(1,47)
Pxl-On(2,47)
Px-Off(2,47)


For EVERY PIXEL from the top of the screen to the bottom... It took up so much time writing that...
  
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 2
» 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