- For a cheese stack of 1 cheese round, simply move the cheese to the destination.
- If the stack has n cheese rounds (n > 1), we need to think of a number i which should be between n-1 and 1. Then we have a three step process for moving the stack:
- Move n - i rounds to an intermediate stool.
- Move i cheese rounds to the destination, using the only three available stools.
- Move the n - i rounds of cheese from the intermediate stool to the destination stool
Okay, so we have a nice way of doing things which can easily be applied recursively into a computer program, so far so good. But there is one huge problem keeping us from doing that. That problem is the number i itself. How can we find the most efficient i on each step of the recursion?
This is the hard part of this assignment. The way I coped with this problem was quite painful, but it worked. It took a handful of unsuccessful attempts and a few hours spent trying various different ways to solve this problem until I found a good way to solve this.
What I did was, I tried to move the cheese manually(okay not real cheese, just crappy illustrations on paper) and record the i for every n which gave the most efficient number of moves. After a certain point I tried to find a formula to get the i. I got a few different formulas which gave close enough i's, but after a few of those attempts I figured out a formula that worked. I don't actually know if it worked for enormous numbers but it worked at least up until 25 rounds of cheese so, I just went ahead and used it.
The deadline is already passed but I don't know if I am allowed to give the formula out. Anyways, have a nice week!
No comments:
Post a Comment