------ art_581_8782396.1136145252433 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Mark: could you explain what you mean? these were outputs from that prog: solve(3,1233): [3, 6, 8, 16, 18, 36, 38, 76, 152, 154, 308, 616, 1232, 2464, 2466, 1233] solve(1,25): [1, 3, 6, 12, 24, 48, 50, 25] looks like it finds them just fine... or do u mean that these arent the optimal paths? James: Now that I think about it, your optimization and mine are almost equivalent, I think-- I'm fairly certain that the only way to get to a number that you've been to already is by using consecutive pairs of double/half.. since the add_two operation isn't invertable in this quiz. Maurice On 1/1/06, Mark <mark.ericson / gmail.com> wrote: > > Maurice, > > I just noticed that your solution can't find the path between two odd > numbers. > > - Mark > > On 1/1/06, Maurice Codik <maurice.codik / gmail.com> wrote: > > I guess we're allowed to submit solutions now... here's my first ever > ruby > > quiz solution (these quizzes are a great idea, btw): > > > > It's is an iterated-depth DFS w/ memoization written in a functional > style > > for fun. > > > > It exploits the fact that the optimal path through the maze will never > have > > consecutive double/halves, which reduces the avg branching factor of the > > search tree to ~2. Keeping track of this state makes the code a little > > uglier, but faster on the longer searches. > > > > Maurice > > ------ art_581_8782396.1136145252433--