Just for fun: Countdown numbers game solver
Arnaud Delobelle
arnodel at googlemail.com
Wed Jan 23 02:16:37 EST 2008
On Jan 22, 10:56 pm, dg.google.gro... at thesamovar.net wrote:
> Arnaud and Terry,
>
> Great solutions both of you! Much nicer than mine. I particularly like
> Arnaud's latest one based on folding because it's so neat and
> conceptually simple. For me, it's the closest so far to my goal of the
> most elegant solution.
Thanks! It's a great little problem to think of and it helps bring
more fun to this list. Sadly work takes over fun during the week, but
I will try to improve it at the weekend.
> So anyone got an answer to which set of numbers gives the most targets
> from 100 onwards say (or from 0 onwards)? Is Python up to the task?
I bet it is :)
> A thought on that last one. Two ways to improve speed. First of all,
> you don't need to rerun from scratch for each target
Yes, I've been doing this by writing an 'action' (see my code) that
takes note of all reached results.
> Secondly, you
> can try multiple different sets of numbers at the same time by passing
> numpy arrays instead of single values (although you have to give up
> the commutativity and division by zero optimisations).
Have to think about this.
--
Arnaud
More information about the Python-list
mailing list