On Thu, 26 Feb 2009 23:10:20 -0000, Jonathan Gardner <jgard...@jonathangardner.net> wrote:

[snip]

For each iteration, you take each surviving walker and spawn a new
walker that takes a step in each possible direction. Then you check if
any of those walkers found the value you are looking for. If so,
you've found the answer. If they hit a value you've already seen, you
drop that walker from the set.

This relies each value having the same set of next states no matter how
it's reached.  Unfortunately that's not true.  Consider what happens
when you walk on from (1+3) and (2+2):

One possible step from (1+3) is ((1/3)+3) == 3.33...  There's no single
step from (2+2) that can get you to the same place.

The only hanging point is parentheses. What you can do here is instead
of building a linear expression, build a tree expression that shows
the operations and the values they operate. It should be trivial to
calculate all the different new trees that are one digit longer than a
previous tree.

Trivial yes, but the number of different new trees is large when you're
dealing with four digits, and ridiculous with 5.

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to