Ruby Quiz schrieb:
> (...)
> 
> (my go method)
> 
> The break line is just a minor optimization.  If a treasure didn't 
> work in one pirate's empty bag, it won't work in any of the empty 
> bags following his and we can skip those checks.

You may call it a minor optimization, and I agree it's an easy one. But
it speeds up the whole process around factor 100, so without it my
simple brute force approach would have been intolerable slow.

> As usual, all solutions were educational.  My thanks to all for the 
> code and excellent discussion this time around.

I want to mention Luke Blanchard's second solution. It is the fastest
solution of those I tested that worked without flaws. I never ever saw
it running longer than 0.2 seconds and I did test it a *lot* (because it
is around factor 10-20 faster than the next correct solution, and I
thought it must fail sometimes, but it never did). I couldn't believe
its speed. I studied his code for ca. 30 min just to understand what
it's doing (luckily it's got a lot of comments, I wouldn't have been
able to understand it otherwise). Then I could tell it is indeed
correct, but its speed is nevertheless amazing.

Another interesting solution is the one from 0x002A. It is quite slow,
but if you've never seen anything with lazy evaluation ("require
'lazylist'") you should check it. The concept was new to me and gave me
quite a headache analyzing it (the good kind of headache - I love when
the fog raises and I suddenly understand what's going on).

> Tomorrow we will begin a run of at least three non-NP-complete 
> problems by myself and others...

I see forward to it. I'm not home for the weekend, but I hope to have a
go at it on Monday.

	Manuel