How to program towers of hanoi iterative.

It is assumed you know the basics of the nature of this game.
In general This game allows for 6 possible different start and destination poles.
In a visual program representation any preference can relatively easyly be achieved by
interchanging pole identities. It is not essential for understanding the principles.
In the following , the regiment dictates that the stack of
rings is setup to move from leftmost to the rightmost pole.

So now, when a new game starts you will observe either an EVEN
or ODD amount of rings on the start pole.
That start condition will cast witch moving pattern
to obey strictly to from start to finish.

Care to watch a small ODD animation
Computer man
There are arrows with numbers to indicate sequence of movement
of the top 2 rings. Lets break it down!
[>] or [<] indicates actual physical direction of movement.
How come EVEN is 3 right moves [>] , and ODD
2 right and 1 left move 2[>] 1[<], BUT the depicted arrows point in both
directions ?. It turns out to be because the moves are all circular.
Seasoned programmers go : "something modulo"
Example. if you must move a ring from
the leftmost pole toward left respectively a ring from
the rightmost pole toward right, you
circulate to the opposite pole. From there you continue the direction of movement only
counting now from the new circulated position
For example in the depiction below, the 2 right ( 2 >)
move can masquerade as 1 left , and 1 < left as 2 right.
isn't programming magical ?. But again programmers see it all the time everywhere.

Computer man
After every completion of the 3 moves of the 2 top rings according
to the fixed cast determined by either the EVEN or ODD
initial condition, you perform a pivot move .
That's it!. This particular ever repeating pattern
I.E. top 2 rings in 3 moves, followed by a pivot is continued until
an attempted pivot look into 2 empty poles, in
witch case the game is done.

Computer man
Pivoting means the following :
After every completed 3 move sequence of the 2 top rings you
temporary disregard the pole now holding the top 2 rings.
That reduces the focus only to be between the remaining 2 poles.
The ring to move - or pivot - can now be determined either as the topmost ring on a pole that is not
empty, or as the ring from the pole that holds the smaller ring.
In both cases you move that ring to the other and only available pole
Simple after all?