Guess My Number Game

Andrew Dalke adalke at mindspring.com
Sun May 16 18:37:44 EDT 2004


Andrea Griffini:
> It also has the same problem about guessing too many times.

Mmm, I see your point.  When I've played the game the last
one is supposed to be "then it must be 7".  Here I finessed it
by assuming the player was a wit and chose a non-integer value.

With a bit more work I could make it test if numbers from
either side have been tested and abort early.

> It's also funny to see a bisection search called the "heavy
> work": the convoluted (and IMO somewhat ugly) code used to
> be able to call bisect is much more complex and less
> intuitive than the bisection code itself.

Yeah, I was smiling too when I wrote it.  It was more of a
"look at how leet my code is."  :)

                    Andrew
                    dalke at dalkescientific.com





More information about the Python-list mailing list