How to program towers of hanoi iterative.

When a new game starts you might observe an EVEN
or ODD amount of rings on the start pole.
Witch ever alternative is met there, will determinate witch pattern
to follow from start to finish. The game allows for 6 possible different start and destination poles.
In a visual representation these 6 alternatives can be achieved by
interchanging pole names.
Here the regiment dictates that the stack of rings is setup to move from leftmost to the rightmost pole.

Care to watch a small ODD animation
Computer man
How come EVEN is 3 right moves, and ODD
2 right and 1 left move, but the depicted arrows point in both
directions ?. It turns out all moves are circular.
So seasoned programmers go : "something modulo I got it!"
I.E. 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 and 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 ?.

Computer man
After every performed 3 moves of the 2 top rings according
to the fixed pattern from 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?