I need a faster computer or a faster brain. I've got a brute force algorithm that appears to work, but it won't complete in anything like three minutes.
I expect this quiz to yield a great amount of different solutions and I'm already looking forward to seeing the first of them tomorrow.
Choosing different approaches will result in wildly differing runtimes, as I have found out myself.
My first try took about one hour (intelligent guess, i never let it run that long) in the worst case (ie. when there was no exact solution). My new implementation takes... well... a bit less...
On Sun, Nov 14, 2004 at 07:34:07AM +0900, Steven Jenkins scribed:
I need a faster computer or a faster brain. I've got a brute force
algorithm that appears to work, but it won't complete in anything like
three minutes.
3 minutes is doable - you'll get it. Mine takes either 110 seconds
or 11 seconds depending on the setting of the magic option that
might be a spoiler to talk about. The difference between my
implementation's time and the previous poster's is probably due
more to machine speed differences than anything.
I guess I won't reveal the number until tomorrow, but my count of the
distinct calculation expressions you can form with six numbers and four
operators (not accounting for commutativity) is uhh... big.
It's probably not giving too much away to say that the number is
still expressable as 32-bit integer.
Now if only I could figure out how to make the code more
elegant. This is a terrible time-suck!
-Dave
···
--
work: dga@lcs.mit.edu me: dga@pobox.com
MIT Laboratory for Computer Science http://www.angio.net/
On Mon, 15 Nov 2004 04:08:22 +0900 > Dennis Ranke <dennis.ranke@epost.de> wrote:
>>
Shouldn't each_term_over call the block for each term when the terms for this set of sources was already generated before as well? Now it just returns the terms but each_term_over itself just ignore the return value. But maybe I just didn't understand the code correctly, after all, it appears to work well (although using too much memory on my machine
each_term_over calls the block once for each unique term it generates.
When a set of terms is already memoized, the block has been called for
> each of the terms in the set, so it is not neccessary to call it again.
This additionally speeds up the process.
Oh yes, I misread the source, sorry. Of course each_term_over itself uses the returnvalue, I didn't notice the each the first time I read the source and thought the block was called by the recursive function.
This is interesting information, especially to someone like me who is not familiar with the game show. To be fair, it was not mentioned in the quiz, that I can see.
James Edward Gray II
···
On Nov 13, 2004, at 7:18 AM, daz wrote:
It's not allowed in the television game:
"... all the steps to the solution must be whole numbers.
e.g. You cannot start by dividing 7 by 5 and then use
1.4 in subsequent steps."
> It's not allowed in the television game:
>
> "... all the steps to the solution must be whole numbers.
> e.g. You cannot start by dividing 7 by 5 and then use
> 1.4 in subsequent steps."
This is interesting information, especially to someone like me who is
not familiar with the game show. To be fair, it was not mentioned in
the quiz, that I can see.
James Edward Gray II
Even the opposite applies:
From the quiz:
Normal arithmetic rules apply, and in particular you are not allowed to >use integer rounding. That is, 7 divided by 3 is 2 1/3, not 2.
I conlude from this, that it is allowed to calculate using fractions.
I think it is really interesting to see, that in this quiz as in the real world a perfect specification is only achievable with an unproportional amount of work. So that is where the classic waterfall modell has its weakness. /Lets all programm pragmatically, and include feedback/ ;).
Regards,
Brian
···
On Sun, 14 Nov 2004 01:28:50 +0900 James Edward Gray II <james@grayproductions.net> wrote: