Author Topic: Undocumented TI-BASIC tricks  (Read 83144 times)

0 Members and 2 Guests are viewing this topic.

Offline tifreak

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2708
  • Rating: +82/-3
  • My Kung Fu IS strong...
    • View Profile
    • TI-Freakware
Undocumented TI-BASIC tricks
« Reply #60 on: December 26, 2005, 12:58:00 pm »
No problem, I hope you understand it... :Dbiggrin.gif
Projects: AOD Series: 75% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%

Offline Spellshaper

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1690
  • Rating: +0/-0
  • This is me. Or maybe not.
    • View Profile
Undocumented TI-BASIC tricks
« Reply #61 on: December 27, 2005, 12:36:00 am »
yeah, now I do >Dgni.gif

Offline tifreak

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2708
  • Rating: +82/-3
  • My Kung Fu IS strong...
    • View Profile
    • TI-Freakware
Undocumented TI-BASIC tricks
« Reply #62 on: December 27, 2005, 02:28:00 am »
Glad I could be of help. :)smile.gif
Projects: AOD Series: 75% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%

dragon__lance

  • Guest
Undocumented TI-BASIC tricks
« Reply #63 on: December 28, 2005, 10:21:00 am »
now i've got a few questions, at the UnitedTi forum, there's a lot about max speed in basic. i'd like to know if they're true.
-are if-then statements faster than if statements?
-The more free ram, the faster the prgm will run?
-too much prgm in prgm menu, will run slower?
-does optimising improve speed, ex: not(A, A=0
-is while faster or repeat loops
Thanks if u can help...:)smile.gif

Offline tifreak

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2708
  • Rating: +82/-3
  • My Kung Fu IS strong...
    • View Profile
    • TI-Freakware
Undocumented TI-BASIC tricks
« Reply #64 on: December 28, 2005, 11:11:00 am »
If statements are faster, here is why:

Everytime the calculator sees a Then statement, or a loop, it registers how many End statements it sees. This of course takes little processing power (I think) but over a long period, it can cause a slow down, hence the memory leaks. If you just use an If statement, it doesn't need to worry about an End statement... Using an If statement only allows 1 command to be used, though, so watch yourself.

If I remember correctly, the amount of RAM does not slow down or speed up a program.

Actually, this will slow a program down a little, because that means it has to search the VAT entries for more programs.

Some optimizing does, but others can actually slow down a game.

If K=25:Then is actually faster then A-((K=25)-(K=26))->A because it is looking for the K with an If statement, but with the equation, it actually keeps doing the equation over and over. If K does not =25, then it ignores what ever comes after it. :)smile.gif

I honestly don't know of a speed difference between the two, but there could be, if someone else here knows...
Projects: AOD Series: 75% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%

tenniskid493

  • Guest
Undocumented TI-BASIC tricks
« Reply #65 on: December 28, 2005, 11:26:00 am »
Both While and Repeat Loops are equal in speed.  I believe Arcane Wizard answered that at UnitedTi.  I'll try to find the link.

EDIT:  Fixed it.

Offline tifreak

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2708
  • Rating: +82/-3
  • My Kung Fu IS strong...
    • View Profile
    • TI-Freakware
Undocumented TI-BASIC tricks
« Reply #66 on: December 28, 2005, 11:33:00 am »
Don't you mean while and repeat?
Projects: AOD Series: 75% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%

tenniskid493

  • Guest
Undocumented TI-BASIC tricks
« Reply #67 on: December 28, 2005, 11:36:00 am »
Yup, sorry about that.

dragon__lance

  • Guest
Undocumented TI-BASIC tricks
« Reply #68 on: December 28, 2005, 11:41:00 am »
another questions: which are faster: subroutines or if-then statements?

tenniskid493

  • Guest
Undocumented TI-BASIC tricks
« Reply #69 on: December 28, 2005, 11:44:00 am »
If:Then's are faster than subroutines.  However, if you are doing the same thing inside the If:Then statement multiple times, you could save a lot of space by using subroutines.  Its sort of a trade off.

dragon__lance

  • Guest
Undocumented TI-BASIC tricks
« Reply #70 on: December 28, 2005, 11:48:00 am »
anyone kno some cool optimisations using boolean logic (xor, or, and, not). one that i kno that toggles the number would be:
:N(A=0)->A
this will toggle A from 0 to the number(N). anyone kno more?

tenniskid493

  • Guest
Undocumented TI-BASIC tricks
« Reply #71 on: December 28, 2005, 11:53:00 am »
For my walking engine, I used:

X-8(K=24)+8(K=26)->X
Y-8(K=25)+8(K=34)->Y

EDIT:  Wait nvm, your the one who gave me that.

Offline Radical Pi

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1143
  • Rating: +5/-2
    • View Profile
    • RealityRevolution
Undocumented TI-BASIC tricks
« Reply #72 on: December 28, 2005, 12:35:00 pm »
All sorts of (), +, and = combinations can replace and/or.

Someone should make a Boolean converter for long expressions.

---EDIT---
And subtraction might be able to replace xor.
One of these days I'll get a sig I'm really proud of.

dragon__lance

  • Guest
Undocumented TI-BASIC tricks
« Reply #73 on: December 28, 2005, 02:46:00 pm »
wat do u mean? and ive got another question, will variable inputs run slower, faster, or same speed, for instance,
real(3,0,0,1
or
real(3,A,A,1   where A=0

tenniskid493

  • Guest
Undocumented TI-BASIC tricks
« Reply #74 on: December 28, 2005, 03:17:00 pm »
I believe they run the same, however I am not positive on that.

I belive what Radical Pi meant was that instead of doing

c1-->
CODE
ec1If X=1 and Y=3
Z+15->Zc2
ec2

You can do
c1
-->
CODE
ec1Z+15(X=1)(Y=3)->Zc2
ec2

If thats not what you meant, post an example.