|Syntactic Confectionery Delight|
Challenge: Egg Timer Puzzlesby Limbic~Region (Chancellor)
|on May 02, 2006 at 23:13 UTC||Need Help??|
Limbic~Region has asked for the
wisdom of the Perl Monks concerning the following question:
Some egg timers look like a scaled down version of an hour glass. There are a number of puzzles for cooking eggs a specified amount of time where the solution isn't obvious. It requires realizing that by turning over two egg timers at the same time when the smaller has finished you can stop the larger and have 2 new amounts to work with.
For instance, given 7-min & 4-min egg timers, you can split the 7-min into 4/3. You can split the 4-min into 1/3 by turning it over twice in the time the 7-min runs once. Continuing that further you can split the 7-min into 1/6 by letting the 1 minute side of the 4 run.
You get the picture.
The challenge is to create a program that - given a target amount and a variable amount of egg timers, will generate solution(s) for the puzzle. All solutions are welcome but non-straight forward approaches will get creativity bonus points. For those following along at home, adding an explanation in spoiler tags will get you tutelage bonus points.
Update: There are 2 aspects of this puzzle so far that have been interpreted differently. The first is the number of timers. I intended this to be a specific number and not an infinite amount. The second is if timers have to run continously or can be set aside (by turning them on their side). My intention was to allow timers to be stopped for later use. Feel free to intepret the problem any way you want, but these were my intentions.
Update 2: Given an infinite amount of time it may be possible to arrive at any value running timers end to end as it would be by "saving off intermediate values". I don't have proof either way but I suspect some values would only be possible by stopping timers. To force the issue, a nice variation would be to impose an overall time limit for cooking the egg (IOW minimize the overall time). Your choice.
Cheers - L~R