From: Christer Nilsson Date: 2006-01-05T00:50:49+09:00 Subject: Re: Numeric Maze (#60) Kero wrote: > I can not accept the title of fastest solution. I think there are a lot of winners here. Your code executed fastest for one problem. It's quite difficult to filter out a single winner. A lot of different problems has to be defined. So, the person owning the problem formulation privilege, has all the power. One remedy for this would be to let every participant suggest one problem (start and target) each. Then every solver has to solve all suggested problems, and the solvers will get a score according to their rank for each individual problem. That's a lot to administer. A cut off time has to be decided, say one second. And then we have the problem with "dirty" integers, some solutions leave after execution. Should the clean up time be included? "Dirty" Integer: By attaching data to the Integer objects, like "parent" and "queue", Arrays can be avoided. But the next call to "solve" will be affected, if the Integers are not clean. See Quiz#60.20, line 2. As I submitted this Quiz, I wouldn't like to be part af that contest. > Did you do other things than eliminating method calls? Inline code only account for an improvement of 7%, so the answer is yes. > If you did other things, I'd be interested to see it, still. I've sent the code to James. Eventually it will published in his wrap-up. If not, it will be submitted to the ML. > However, I need 21 seconds for 868056 -> 27 so I would assume that > searching for prefixes, or the approach from two sides has lots of potential. Agreed, searching from two sides could probably gain a lot. If we have a distance from start to target of 10, with an average branching factor of 2, the workload should be proportional to 1024. Starting from both sides, the workload should be something like 32 + 32 = 64, with a potential of being 16 times faster. I haven't even tried this approach, yet. Christer -- Posted via http://www.ruby-forum.com/.