Ratio speed:size
 50%  [ 8 ]
 6%  [ 1 ]
 12%  [ 2 ]
 0%  [ 0 ]
 31%  [ 5 ]
Total Votes : 16

Thanks to Mateo, I've replaced the timer with another, safe one, and this is much easier to calculate the time. It displays again 2 numbers (I gonna change it), and you need to calculate this:

If I'm right, this wouldn't cause a RAM reset, or anything else. You can download it still here:
Have fun! Smile

I've changed it so, that the values are loaded in G and H (TIOS variables). Instead of a difficult formula, just calculate 2H+G/32768 and you're done!
To test it, I've made this program:

Disp 2H+G/32768

The output is ~0.57

I've made a stopwatch/timer program, which is only 1 program, and it reads the input from Ans.
Call 1:Asm(prgmTIMER) to start the timer, and 2:Asm(prgmTIMER) to stop. After it stops, the time is in Ans. The program is yet only available at TI-Planet, but I've uploaded it to our Cemetech Archives Smile Btw, with an almost empty VAT and Archive, I'm at the 4.2 seconds with 92 bytes... Wink :troll:
I think I'm winning again in speed. Can't tell exactly.

Vsn   Time (s)  Size (bytes)
A5    4.59      82
A6    4.60      79
A7    4.15      81
B1    38        ~300
B2    32.8      296
B3    28.8      ~300

Lastest competing version is 93 bytes counting the VAT header (79 without), and 4.60 0.01 seconds on jsTIfied on 2.55MP.

EDIT: New version A6.

EDIT: New version A7. Speed: 4.15 0.01 seconds averaged over 50 trials. This is close to the speed of SortA(, which, according to jonbush, takes around 4.1 seconds.
Well, including VAT for a 5-character name, I'm at 128 bytes, and around 36 seconds in CEmu, with some clever tricks, so I'm really impressed by these results.

For comparison's sake,
clocks in around 0.86 seconds in CEmu and
at 0.77, so 4 seconds is shockingly fast, especially given that you're testing in jsTIfied, which is emulating a much slower processor. I'm looking forward to seeing the winning code.


And SortA(L1 is clocking in around 0.49 seconds in CEmu.
earthnite, can we add to the spreadsheet times for sorting randInt(1,1000000,256)? Although it isn't the official parameter, I think it's also an interesting category; none of the top four programs work for such input.

By the way, my fastest program is 81 bytes, not 79.
I'm down to 29.something seconds, same footprint. Notably, mine will also fail to sort randInt(1,1000000,256), though I have a second implementation that will handle it, but hasn't been optimized as thoroughly.
earthnite wrote:
Hello all, I have created an excel sheet with some of the data to see how everyone is doing score wise. You can see the chart here.

Current scores:


      Member        Score
lirtosiast           89
grosged              83
earthnite+jonbush    81
PT_                  75
mr womp womp         33
StarTrekVoyager      28
caleb1997            25
elfprice13           20

Great job everyone!

The chart should provide a decent representation of the final scores for the first challenge. I assume PT_ will test everything himself for consistency, so your mileage may vary.

It would be nice if we could keep this up to date and accurate, so if anything needs to be modified, please notify earthnite, jonbush, or post your information here.

After discussing lirtosiast and grosged's insane speeds with jonbush, we realized that we have the exact same code and are now working together to see if we can compete with them.

No the 51 bytes (unfortunately) don't include vat, and I'm not too sure it will have such a massive speed boost on the CE anymore, but it's bound to have some sort of increase... At least I've got the smallest... It's not what this competition was about but whatever, I can't get the faster methods to work (although I have a rough idea of how it could be done)
Good job, everyone !!
Hey !..Lirtosiast would reach 3.50 seconds ?!

My time's still 3.80 seconds & 97 bytes (it seems I won't find anymore improvement , really stuck! hehe)

Concerning the tool/timer to calculate programs' respective precise times, I kept on working on mine (based on WatchDog TImer) . Here are my improvements :
-the result (given by WDTreset ) has to be divided by 32768 (at last!), (thus it's more accurate than earlier version)
-the result gained in precision : when you reset & suddenly read , the result will be either 0,1 or 2 , as the reading program WDTread substracts the time WDTreset took before !

Program WDTreset : (WatchDogTimer reset)


ld a,%10000
ld hl,$f1000c
ld (hl),a
ld bc,$ffffff
ld de,$5ab9ff
ld l,4
ld (hl),bc
ld l,7
ld (hl),de
ld l,$0c
inc a
ld (hl),a

Program WDTread (WatchDogTimer read) :


ld hl,$f10000
ld hl,(hl)
ld de,$ffff0d
or a,a
ex de,hl
sbc hl,de
jp _DispHL

Unfortunately, the result won't be in Ans, it must be typed again then didived by 32768
(improved maybe later... I'm not friend with OP1, OP2 etc...)

will display 0,1 or 2
(not perfect, but better isn't it ? Smile )
I would still recommend my Stopwatch, you can download it here. This is a very easy-to-use timer, and it's very accurate (upto 1/32768 seconds)

How are your algorithms going? Tomorrow a new task for you all! Very Happy I hope you still like this haha
Also, please vote in the poll for a good ratio speed:size! Smile
Down to 122 bytes (with 5 byte program name) and 26.9 seconds. Which is ... a respectable speedup, but I suspect I'm not going to touch what the rest of you are doing, as I have no ideas on "vectorizing" the last chunk of my inner loop. Unrolling can save me a handful of stores and branches, but doesn't really seem worth it for the minimal improvement and huge size blowup.

1 minute and 37.09 seconds with 75 byte size with VAT header SORT3. (first task)
And... it's time for da second task!
I hope you all liked the first one, and if not, sorry for that Wink

We all love TI-BASIC, right? That's why we're participating. In TI-BASIC, it's sometimes necessary to store an expression in a string, for example when reading from an appvar. To get the actual value of that, we do have the command expr(. But what can expr( do? Well, it's mostly for math. There are more functions you can't do with that, than you can. But don't be frustated, math is as funny as well. There are many, many math commands (look in the Catalogus if you don't trust me), but some of them we don't need. But do you also believe that it parses not only math? You can even have a list or matrix stored in the string.
And that is what this new task is about. You have to write an algorithm that parses a string, like expr( does. Of course, there are some limits.
1) We don't need all the math commands, only this commands are in the string: *-/+^().0123456789sqrt(
2) You're not allowed to store the string elsewhere, and get the value by calling that function. Such as String>Equ( : Y1(1 is not allowed. Like that, |u, |v, |w and even storing it to a list is not allowed. Maybe there are more ways to get it directly - not allowed. You have to parse the string yourself.
3) You're not allowed to have expr( in your whole program (duh Razz)

To summarize this all:

Task 2

Create an algorithm that parses a string with the following characters in it: *-/+^().0123456789sqrt(. The input is in both Ans and Str1. You may assume the length of the string is not more than 99, and more than 10. Again, the time is measured over 10 times parsing a string. An example would look like this:


In this case, the output should be 89.173866... The order of operations are important. The output value should be in A, as many decimals as a TIOS variable can store. As you can see, the input doesn't need to close parenthesis. You may assume the string contains no errors, such as 5(+3.
The scoring is the same as task 1, so you know speed is more important as size..

I wish you all good luck, and if you don't like this one, remember this is only #2, and there are more coming tasks which are that hard....
If you have any questions, please ask! Smile

As I said, don't send the programs yet. After all the tasks you can, but now you have to store it yourself.
Some questions:

What do we do if there's overflow mid-calculation, for example sqrt(10^120)? Will there ever be division by 0, or 0^0, or imaginary square roots? Will the string include any negative signs? What about implied multiplication? Will there be leading zeroes in decimal literals? Is ".1" a valid literal? What about "1." or "."?

EDIT: I've devised a faster algorithm for sorting randInt(1,1000000,256). As usual times are jsTIfied running an 84+ with 2.55MP, and size doesn't count VAT.

Vsn   Time (s)  Size    Can sort arbitrary range?
A7    4.15      81       n
B3    28.8      ~300     y
C1    14.?      ~250     y
lirtosiast wrote:
Some questions:

What do we do if there's overflow mid-calculation, for example sqrt(10^120)? Will there ever be division by 0, or 0^0, or imaginary square roots? Will the string include any negative signs? What about implied multiplication? Will there be leading zeroes in decimal literals? Is ".1" a valid literal? What about "1." or "."?

1) There will not be an overflow error.
2) You don't have to divide by 0, or calling 0^0, neither imaginary square roots
3) No, not the negative sign, only the minus sign
4) There will be always a * between necessary parens or numbers
5) Yes
6) No, that would be 0.1
7) That will not happen
Very important note!
Normally spoken is the ^ token right-associative, which means 2^3^4 = 2^(3^4). In expr( not!!!!
There 2^3^4 = (2^3)^4!!! This can make really difference, so you're warned Smile
Oh crap theres a second already? I can barley get the first one faster than 6 minutes at 100 bytes! Surprised
I feel like a noob Smile
andressevilla wrote:
Oh crap theres a second already? I can barley get the first one faster than 6 minutes at 100 bytes! Surprised
I feel like a noob Smile

Keep going. You can do it!
andressevilla wrote:
Oh crap theres a second already? I can barley get the first one faster than 6 minutes at 100 bytes! Surprised
I feel like a noob Smile

That's not too bad, you're not a noob, many people didn't manage to get near the 5-10 second mark, I think this means they simply understood/found something others didn't, but that's kind of what these contests are about, when the first one will be officially over, I will be very interested in seeing how Lirto and the others did it Very Happy There is no way they did it the same way I did which is the only way I got it to work Razz
And you can always do better on the next competitions! Having completed the challenge, I'd say simply getting an algorithm to work is very good.
Please submit and update your program statistics using this form to have your program added to the leaderboard

For the record, there will be no nested parentheses for challenge 2:

<jonbush> Will there be nested parentheses? like (sqrt(6/2)^(11))*(39.1)
<saxjax> [lirtosiast] as subroutines (for example, literal parsing and a stack)
<saxjax> [PT_] Nope
<jonbush> That's good
<saxjax> [lirtosiast] No nested parens makes this much easier.
<saxjax> [PT_] I shouldn't make it harder as it is
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
» View previous topic :: View next topic  
Page 4 of 7
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum