Tower of Hanoi algorithm. It's hard-coded for 5 disks. This is a problem I have assigned to my students to work on as well. I used the following approach from the Tower of Hanoi Wikipedia page: For an odd number of disks: make the legal move between pegs A and C (in either direction) make the legal move between pegs A and B (in either direction) make the legal move between pegs C and B (in either direction) repeat until complete