Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: JWinslow23 on November 06, 2013, 05:47:30 pm

Title: Cookie Clicker
Post by: JWinslow23 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?
Title: Re: Cookie Clicker
Post by: Yeong on November 06, 2013, 06:50:10 pm
I played Cookie Clicker before. :3

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.
Title: Re: Cookie Clicker
Post by: Sorunome on November 07, 2013, 11:26:40 am
Can you maybe please upload a 8Xp for that?/me is to lazy to tokenize x.x
Title: Re: Cookie Clicker
Post by: JWinslow23 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.
Title: Re: Cookie Clicker
Post by: Keoni29 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.
Title: Re: Cookie Clicker
Post by: JWinslow23 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.
Title: Re: Cookie Clicker
Post by: blue_bear_94 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.
Title: Re: Re: Cookie Clicker
Post by: DJ Omnimaga 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.
Title: Re: Cookie Clicker
Post by: Hayleia 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+.
Title: Re: Cookie Clicker
Post by: JWinslow23 on November 09, 2013, 08:30:04 pm
OK, I'm glad it's getting a somewhat good review. Hopefully it can support Golden Cookies soon!

Oh, and I missed the Alchemy Lab building. I'll modify the code soon enough.