I finished the hard one in about 12 minutes. I then tried the kids one. It took me 45 seconds
I finished the hard one in about 12 minutes. I then tried the kids one. It took me 45 seconds
Is there some algorithm or something to it?
In fact, yes, both of these are true. The Towers of Hanoi is a puzzle which is solved using what is called a "recursive algorithm" which results in what is called an "inductive pattern".
The idea here (and you'll encounter this if ever you go into higher maths and have to deal with proofs) is that you're first solving the arbitrary case of moving just one more disk from any one stack onto any other stack, and then you're solving the base case of how to move a stack of one onto an empty space - and here's where the magic happens - you combine these two. It seems very simple at first blush, and really, it is, but it's extremely powerful behavior. With just those two piece of knowledge, you can in fact solve any size towers-of-hanoi type puzzle, and more than that, you can prove that you can solve them without actually having to shuffle disks around.