0 Members and 1 Guest are viewing this topic.

#### JWinslow23

• Coder Of Tomorrow
• LV7 Elite (Next: 700)
• Posts: 556
• Rating: +43/-6
• I make quality calculator games...when I have time
« on: November 06, 2013, 05:47:30 pm »
This is my code for a Cookie Clicker game with support for a TI-83+ OS 1.19 (and possibly other platforms).

Code: [Select]
DelVar L₁ClrHome
SetUpEditor CLICK
10→dim(∟CLICK
∟CLICK→L₁
9→dim(L₁
Output(3,5,"=----------- OO !CURSOR     OO*O!PRICE:     O*OO!           O*OO!OWNED:      OO !
∟CLICK(10→C
"CURSOR     GRANDMA    FARM       FACTORY    MINE       SHIPMENT   PORTAL     TIMEMACHINEANTIMATTER →Str1
DelVar S1→B
{15,E2,500,3E3,E4,4E4,1666666,123456789,4E9-1→L₂
For(X,1,9
int(L₂(X)1.15^L₁(X→L₄(X
End
{.1,.5,4,10,40,E2,6666,98765,E6-1→L₃
Output(6,6,L₄(1
Output(8,6,L₁(1
Repeat K=45
getKey→K
If K=105
Then
Output(1,1,"                "
C+1→C
Output(1,1,int(C
End
B+(K=26)-(K=24
Ans-9(Ans=10)+9not(Ans→B
Output(4,6,sub(Str1,11B-10,11
If sum(K={24,26
Then
Output(6,6,"           "
Output(6,6,L₄(B
Output(8,6,"           "
Output(8,6,L₁(B
End
L₁(B)-(K=85 and L₁(B))+(K=95 and C≥L₄(B→L₁(B
If K=95 and C≥L₄(B
Then
int(L₂(B)1.15^L₁(B→L₄(B
Output(6,6,"           "
Output(6,6,L₄(B
Output(8,6,"           "
Output(8,6,L₁(B
Output(1,1,"                "
Output(1,1,int(C
End
If K=85
Then
int(L₂(B)1.15^L₁(B→L₄(B
Output(6,6,"           "
Output(6,6,L₄(B
Output(8,6,"           "
Output(8,6,L₁(B
End
If not(S
Then
C+sum(L₁L₃→C
Output(1,1,int(Ans
End
Output(2,1,"                "
Output(2,1,int(sum(L₁L₃
S+1-4(S=3→S
End
C→L₁(10
L₁→∟CLICK
ClrHome

What do you think?
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
= ?

#### Yeong

• Not a bridge
• LV12 Extreme Poster (Next: 5000)
• Posts: 3739
• Rating: +278/-12
• Survivor of Apocalypse
« Reply #1 on: November 06, 2013, 06:50:10 pm »

I'll try out when I have time.

Also, the basic tip of TI-BASIC optimization is that you don't need those end quotation marks.
Sig wipe!

#### Sorunome

• Fox Fox Fox Fox Fox Fox Fox!
• Support Staff
• LV13 Extreme Addict (Next: 9001)
• Posts: 7920
• Rating: +374/-13
• Derpy Hooves
« Reply #2 on: November 07, 2013, 11:26:40 am »
* Sorunome is to lazy to tokenize
 THE GAMEAlso, check out my websiteIf OmnomIRC is screwed up, blame me!Click here to give me an internet!

#### JWinslow23

• Coder Of Tomorrow
• LV7 Elite (Next: 700)
• Posts: 556
• Rating: +43/-6
• I make quality calculator games...when I have time
« Reply #3 on: November 07, 2013, 07:05:25 pm »
Also, the basic tip of TI-BASIC optimization is that you don't need those end quotation marks.

I know, but this is not included in the actual game. This is only so you can see where they end.

This actually only takes up 973 bytes, minus the name.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
= ?

#### Keoni29

• LV11 Super Veteran (Next: 3000)
• Posts: 2466
• Rating: +291/-16
« Reply #4 on: November 07, 2013, 07:29:35 pm »
It only matters when you need to cram a 12k program in 8k or whatever. For such a small basic program tiny optimization is just a waste of time. You need to save bytes on structure of the program. Check if there are smarter ways to get to the same result. That is what's optimization is all about.
If you like my work: why not give me an internet?

#### JWinslow23

• Coder Of Tomorrow
• LV7 Elite (Next: 700)
• Posts: 556
• Rating: +43/-6
• I make quality calculator games...when I have time
« Reply #5 on: November 07, 2013, 07:51:14 pm »
You need to save bytes on structure of the program. Check if there are smarter ways to get to the same result. That is what's optimization is all about.

That's part of the reason I posted it here. I can't think of any improvements.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
= ?

#### blue_bear_94

• Posts: 801
• Rating: +25/-35
• Touhou Enthusiast / Former Troll / 68k Programmer
« Reply #6 on: November 07, 2013, 08:30:13 pm »
It only matters when you need to cram a 12k program in 8k or whatever. For such a small basic program tiny optimization is just a waste of time. You need to save bytes on structure of the program. Check if there are smarter ways to get to the same result. That is what's optimization is all about.
It always matters. Small optimizations add up.
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55872
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
« Reply #7 on: November 07, 2013, 09:27:05 pm »
Every byte counts, imho. The calc has 24 KB of RAM and a few hundreds of archive, so if you have many math programs and games, memory can fill up fast.

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
« Reply #8 on: November 08, 2013, 12:33:41 am »
Also think about your users. Maybe you have a 84+SE, but maybe someone with a regular 83+ will want to play your game, and there is not so much archive in a 83+ so you have to make your program as small as possible. See, Matrefeytontias doesn't put end brackets in his Axe sources even though that is not advised and even though it doesn't optimize anything in the compiled result, but he has a regular 83+.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### JWinslow23

• Coder Of Tomorrow
• LV7 Elite (Next: 700)
• Posts: 556
• Rating: +43/-6
• I make quality calculator games...when I have time