# What is the optimal strategy to solve Hanoi Solitaire?

I recently discovered for the first time a variation of Solitaire called Hanoi (sometimes spelled Hanoy or Hanoii). My Solitaire app says it's rated easy, but I have never solved it because I only get so far before I get stuck. Is there a simple strategy I can employ to finally start winning?

• Can you point is to your solitaire app? Is this the card solitaire version or the disk version? What is the goal? I suspect that I can provide the answer but need more detail. Commented May 25, 2015 at 20:16
• It's the card version. 9 cards of one suit are arranged randomly in 3 stacks, and the object is to sort them into one stack by moving only one card at a time and never placing a higher ranked card on top of a lower one. Commented May 25, 2015 at 23:29
• Does the initial setup possibly have cards that are not in a legal position at the start of the game? Example: 5 on top of 2. Commented May 25, 2015 at 23:41
• Yes, as a matter of fact it does. Commented May 25, 2015 at 23:44

The biggest piece of strategy is knowing how to move a pile of cards from one stack to the next.

The basic algorithm is a recursive algorithm.

To move n cards from stack a to stack b, you need to:

1. move the n-1 cards from stack a to stack c
2. move the nth card to stack b
3. move the n-1 cards from stack c to stack b.

To move a stack of three from a to b you need to move the two cards from a to c. To move the two cards from a to c you need to move the one card from a to b. Move the second card from a to c. Move the first card from b to c. Move the third card from a to b. To move the two cards from c to b, we need to move the first card from c to a. Move the second card from c to b. Move the first card from a to b.

The key strategy is to keep one ordered stack. When a new card is unearthed, put it in to the stack in the order that it belongs by moving your stack that belongs on top of the new card to it and then moving it to the top of your ordered stack.

This strategy will not likely lead you always to the shortest solution but will lead you to a correct solution.

There are more basic strategies for the Towers of Hanoi peg and disc game on the Wikipedia article http://en.m.wikipedia.org/wiki/Tower_of_Hanoi but I'm not sure how explicitly applicable they are to this game.

• Actually, I've had a look at it the past few days and have come up with some strategies of my own. If I focus on the little parts, which fits well with the idea of recursion but less technical for the layperson, and if I have different moves for the top card in an odd stack versus an even stack, I've found I can finish the game quite easily now. For higher cards such as 9 which are somewhere in the middle, it helps to move one of those cards to an empty space as soon as I can. Commented May 26, 2015 at 0:38

make a table called input-output and rule and ask your kids to grab a deck of cards and only pick out the ace,the 2,3,4 the rule is to double each number, for example, double 12 = 24.start with the bottom