Author Topic: New Tricks For Pure Basic Coders.  (Read 12153 times)

0 Members and 1 Guest are viewing this topic.

Offline nitacku

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 300
  • Rating: +30/-1
  • ni-ta-ku ^_^
    • View Profile
New Tricks For Pure Basic Coders.
« Reply #30 on: November 07, 2007, 03:54:00 pm »
Holy crap! This could make many things so much easier.
Especially things where you want to save memory.

Offline Speler

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 857
  • Rating: +6/-2
    • View Profile
New Tricks For Pure Basic Coders.
« Reply #31 on: November 08, 2007, 09:21:00 am »
It's somewhat slower but that can be useful.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
New Tricks For Pure Basic Coders.
« Reply #32 on: November 08, 2007, 09:34:00 am »
c1-->
CODE
ec1:DelVar X"X+(Ans=26)-(Ans=24->u
:While 1
:Output(1,1,X
:getkey
:u:Ans->X
:Endc2
ec2
Could be used in menus, since it is slower (saving some bytes when needed).

angel14995

  • Guest
New Tricks For Pure Basic Coders.
« Reply #33 on: November 08, 2007, 10:32:00 am »
And what's even better is you can save the value of u or v into a normal variable (just checked). Its really useful I can see for using the same formula over and over... hehehe, no need for prgmθTDH anymore, u -> H will got fine, and smaller :)smile.gif

Offline Speler

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 857
  • Rating: +6/-2
    • View Profile
New Tricks For Pure Basic Coders.
« Reply #34 on: November 08, 2007, 10:38:00 am »
I suppose I should mention that you can do a similar thing with lists.  Try this:

:"randInt(1,3,2->LA
:Disp LA

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
New Tricks For Pure Basic Coders.
« Reply #35 on: November 08, 2007, 01:29:00 pm »
This could be really useful with xlib ;)wink.gif..

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
New Tricks For Pure Basic Coders.
« Reply #36 on: November 16, 2007, 04:27:00 pm »
QuoteBegin-Super Speler+12 Oct, 2007, 15:33-->
QUOTE (Super Speler @ 12 Oct, 2007, 15:33)
Actually, 10^( is generally a faster way to do the same (or rather, a very similar) thing.  

 I actually just tested this today. 10^( takes 6 seconds while E only takes 4 seconds.

(1000 iterations were done by storing 1000 to variable B.)

c1
-->
CODE
ec1
For(A,1,1000
E3->B
End
c2
ec2

c1
-->
CODE
ec1
For(A,1,1000
10^(3->B
End
c2
ec2

And they both take the same number of bytes, so I would go with E since it is faster.
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline Speler

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 857
  • Rating: +6/-2
    • View Profile
New Tricks For Pure Basic Coders.
« Reply #37 on: November 16, 2007, 04:56:00 pm »
Really?  Did you use StartTmr?  Did you use the 10^( token or write that out?

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
New Tricks For Pure Basic Coders.
« Reply #38 on: November 16, 2007, 05:29:00 pm »
I used the token. And I ran the programs, respectively, 20 times to make sure that it wasn't just a fluke.

Also, I use getTmr->L1 and getTmr->L2 and then subtract the start time from the end time.
There are 10 types of people in this world-- those that can read binary, and those that can't.

Xphoenix

  • Guest
New Tricks For Pure Basic Coders.
« Reply #39 on: November 16, 2007, 07:12:00 pm »
Is getTmr some command I've never heard of?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
New Tricks For Pure Basic Coders.
« Reply #40 on: November 16, 2007, 07:36:00 pm »
same here, must be a 84+ only command.

We should keep this topic for 83+ only, to make sure all optimization tricks works on all calcs in the 83+ series

vuurrobin

  • Guest
New Tricks For Pure Basic Coders.
« Reply #41 on: November 17, 2007, 03:27:00 am »
QUOTE
Also, I use getTmr->L1 and getTmr->L2 and then subtract the start time from the end time.


using gettmr->A and checktmr(A is easier (I think)

yes all time and date functions are 84+ (SE) only, but they are usefull if you want to see if a command is faster or not.  

Offline Speler

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 857
  • Rating: +6/-2
    • View Profile
New Tricks For Pure Basic Coders.
« Reply #42 on: November 17, 2007, 04:49:00 am »
DJ Omnimaga, that's silly.  Not everyone codes on a 83+.

Halifax, if that's true then there are some errors in the Basic Code Timings... someone should redo that using startTmr.

Xphoenix

  • Guest
New Tricks For Pure Basic Coders.
« Reply #43 on: November 17, 2007, 06:45:00 am »
No, no, I HAVE an 84+, I just don't see getTmr in the catalog.

There's Get(, GetCalc(, getDate, getDtFmt, getDtStr(,getTime, getTmFmt, getTmStr(, and getKey. No getTmr.

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
New Tricks For Pure Basic Coders.
« Reply #44 on: November 17, 2007, 06:57:00 am »
Well then it is getTime, which ever one returns a list of three values.

And yes that is very silly, especially since it would be applied to 83+ in some way. I am pretty sure that e3 would be faster on the 83+ too. ;)wink.gif
There are 10 types of people in this world-- those that can read binary, and those that can't.