Author Topic: 100 TI-BASIC Optimizing Tips  (Read 10509 times)

0 Members and 1 Guest are viewing this topic.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
100 TI-BASIC Optimizing Tips
« on: December 14, 2011, 12:52:57 pm »
I think we need this thread at some point :)

I'll post some first! :D

1. 2(X-1)→X to 2(X-1→X to 2X-2→X if numbers are small enough.

2. X*100→X to XE2→X

3. (X-3)/5→X to 5-1(X-3→X

4. If X=1:0→X:Goto A:If X=0:1→X:Goto A (I see this a lot) to abs(X-1→X:Goto A to not(X→X:Goto A

5. Disp "A":Disp X:Disp "B" to Disp "A",X,"B
« Last Edit: December 29, 2011, 06:42:41 pm by TBO_Yeong »
Sig wipe!

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: 100 TI-BASIC Optimizing Tips
« Reply #1 on: December 14, 2011, 12:57:22 pm »
4. If X=1:0→X:If X=0:1→X (I see this a lot) to abs(X-1→X
Also known as not(X→X :P

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: 100 TI-BASIC Optimizing Tips
« Reply #2 on: December 14, 2011, 12:58:07 pm »
4. If X=1:0→X:If X=0:1→X (I see this a lot) to abs(X-1→X
Also known as not(X→X :P
:P I just realized and tried to fix it but you noticed it first anyway XD
Sig wipe!

Offline harold

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 226
  • Rating: +41/-3
    • View Profile
Re: 100 TI-BASIC Optimizing Tips
« Reply #3 on: December 14, 2011, 01:08:52 pm »
1. Disp X   to X  (only as the last command in a program, and messes up Ans)
2. seq(2^X,X,1,8 to 2^cumSum(binomcdf(7,0
« Last Edit: December 14, 2011, 01:09:28 pm by harold »
Blog about bitmath: bitmath.blogspot.nl
Check the haroldbot thread for the supported commands and syntax.
You can use haroldbot from this website.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: 100 TI-BASIC Optimizing Tips
« Reply #4 on: December 14, 2011, 01:12:14 pm »
8. 3+X→Y:Disp Y to Disp 3+X (Unless you want to call up the Ans later :P )
Sig wipe!

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: 100 TI-BASIC Optimizing Tips
« Reply #5 on: December 14, 2011, 01:36:51 pm »
4. If X=1:0→X:If X=0:1→X (I see this a lot) to abs(X-1→X
Also known as not(X→X :P
:P I just realized and tried to fix it but you noticed it first anyway XD
I think you forgot an Else before the second If there.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: 100 TI-BASIC Optimizing Tips
« Reply #6 on: December 14, 2011, 02:59:36 pm »
You don't need the Else there. ;)
Sig wipe!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: 100 TI-BASIC Optimizing Tips
« Reply #7 on: December 14, 2011, 08:02:13 pm »
X/100 to sub(X is a very useful one.
« Last Edit: December 29, 2011, 01:58:19 pm by Deep Thought »




Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: 100 TI-BASIC Optimizing Tips
« Reply #8 on: December 29, 2011, 12:54:16 pm »
I see many people using this getKey routine:
0→K
While K=0
getKey→K
End

It could be optimized to this:
Repeat K:getKey→K:End

EDIT: Here's jacobly's way if you're interested:
0:Repeat Ans:getKey:End
« Last Edit: December 29, 2011, 01:00:13 pm by TBO_Yeong »
Sig wipe!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: 100 TI-BASIC Optimizing Tips
« Reply #9 on: December 29, 2011, 01:47:29 pm »
You can take out the 0 and just use Repeat Ans:getKey:End because getKey returns 0 if no key was pressed.
« Last Edit: December 29, 2011, 01:47:40 pm by Deep Thought »




Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: 100 TI-BASIC Optimizing Tips
« Reply #10 on: December 29, 2011, 02:34:19 pm »
X/100 to sub(X is a very useful one.

Might as well do .1X since sub() is a 2 byte token :P

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: 100 TI-BASIC Optimizing Tips
« Reply #11 on: December 29, 2011, 02:41:44 pm »
Code: [Select]
:Disp "Blah"
:Disp "More Blah"
optimized:
Code: [Select]
:Disp "Blah","More Blah

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: 100 TI-BASIC Optimizing Tips
« Reply #12 on: December 29, 2011, 06:03:23 pm »
X/100 to sub(X is a very useful one.
Might as well do .1X since sub() is a 2 byte token :P
That divides by ten, not 100.




Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: 100 TI-BASIC Optimizing Tips
« Reply #13 on: December 29, 2011, 06:37:43 pm »
Code: [Select]
:Disp "Blah"
:Disp "More Blah"
optimized:
Code: [Select]
:Disp "Blah","More Blah
Don't
Code: [Select]
:Disp "Blah
:Disp "More Blah
takes less space?
Sig wipe!

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: 100 TI-BASIC Optimizing Tips
« Reply #14 on: December 29, 2011, 06:40:15 pm »
You don't need the Else there. ;)
yes you do.... otherwise no matter what X would be 1 by the end.
« Last Edit: December 29, 2011, 06:42:55 pm by ZippyDee »
There's something about Tuesday...


Pushpins 'n' stuff...