I am trying to solve a Variation of the Towers of Hanoi. In this case I have two towers, same height and the disks have the same sizes. I can stack disks onto each other as long as they are the same size or smaller. The color does not factor in to the stacking capabilities.
I have three pegs and two towers and the task is to swap both towers.
My initial approach is to build one tower with alternating colors and then going backwards with just a different peg to move to.
I am just thinking that this is not the most elegant solution. Is there a better way to do this?
Update:
I thought I was pretty close to figuring this out, but I wasn't. I have all the moves (for n=3) on paper and it looks pretty similar to the original algorithm just that lots of moves are done twice. Unfortunately I am not able to put this into a recursive algorithm. This is pretty frustrating. Does someone have an idea?