Just for fun: Countdown numbers game solver

Arnaud Delobelle arnodel at googlemail.com
Mon Jan 21 05:49:19 EST 2008


On Jan 21, 9:01 am, dg.google.gro... at thesamovar.net wrote:
> Hi all,
>
> It's great how many different sorts of solutions (or almost solutions)
> this puzzle has generated. Speedwise, for reference my solution posted
> above takes about 40 seconds on my 1.8GHz laptop, and the less elegant
> version (on my webpage linked to in the original post) takes about 15
> seconds. It seems to me like surely this problem can be more
> efficiently solved than that?

I haven't had the time to look at your solution yet.  I wanted to have
a go without being influenced.

> Arnaud: I haven't had time to play with your solution yet - how quick
> does it run?

I can't run test from here (work) but last night it seemed of the
order of a second on my 2GHz MacBook Pro (it was late and I was quite
tired so I didn't have the energy to time anything...).  It depends if
you stop when you hit the first solution or you want to go through all
of them.  I guess it will run quicker if I don't build a string
representation of each calculation.

You should run a test on your own machine though to make comparisons
meaningful.

> My fantasy is that there is a solution that isn't TOO slow where you
> can just look at the code and go 'Oh yes, of course that works!' and
> understand it immediately. Maybe that's too much to ask even of
> Python! ;-)

It's a laudable goal.  We might get there :)

--
Arnaud



More information about the Python-list mailing list