Solve 4 Pegs Hanoi Tower: Algorithm & Best Move Ideas

  • Thread starter Thread starter Stephanus
  • Start date Start date
  • Tags Tags
    tower
Click For Summary
The discussion centers on the challenge of finding an efficient algorithm for solving the Tower of Hanoi problem with four pegs, particularly when the initial configuration of disks is random. While a recursive approach exists for three pegs, the optimal solution for four pegs remains an unsolved problem, especially with randomized starting positions. Participants note that while there are algorithms for sorted initial configurations, no effective solutions for random setups have been identified. The conversation highlights the difficulty of achieving the shortest moves without resorting to brute force methods, and suggests that discovering a viable algorithm could lead to academic contributions.
Stephanus
Messages
1,316
Reaction score
104
Dear PF Forum,
Do anybody know the algorithm for 4 pegs Hanoi Tower?
In regular initial, we can use array.
But what if the initial configuration is random?
I can do it in 3 pegs, but I've been searching algorithm for 4 pegs every day, on my bed, before I go to sleep. But I can't find any.
The algorithm should find the best move. Not using "brute force"!

Thanks for any idea.

Steven
 
Technology news on Phys.org
The standard way is to use a recursive algorithm:
  1. 3 disks can be done directly.
  2. Assume that you have found how to do it with n disks
    • Use this to move n disks to one of the spare pegs
    • Move the bottom disk to the goal peg
    • Move the n disks from the spare peg to the goal peg.
 
  • Like
Likes Stephanus
Svein said:
The standard way is to use a recursive algorithm:
  1. 3 disks can be done directly.
  2. Assume that you have found how to do it with n disks
    • Use this to move n disks to one of the spare pegs
    • Move the bottom disk to the goal peg
    • Move the n disks from the spare peg to the goal peg.
Yes, of course Svein. But it's not the best/shortest move is it?
 
According to Wikipedia, the optimal solution with 4 pegs is an unsolved problem. And randomizing the starting position certainly does not help.
 
Last edited:
  • Like
Likes Stephanus
mfb said:
According to Wikipedia, the optimal solution with 4 pegs http://Tower_of_Hanoi#With_four_pegs_and_beyond . And randomizing the starting position certainly does not help.

Thanks mfb,
There is, actually, an algorithm for a sorted initial position, but for a random position, well... Maybe? I've been trying for two months before I sleep. Still can't find solutions. Perhaps you're right.
 
Last edited by a moderator:
(I fixed the link in the previous post)

On the positive side, if you find an efficient algorithm, you can write a paper about it.
 
  • Like
Likes Stephanus
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

  • · Replies 25 ·
Replies
25
Views
5K
Replies
14
Views
3K
Replies
2
Views
3K
  • · Replies 11 ·
Replies
11
Views
4K
Replies
2
Views
8K
  • · Replies 16 ·
Replies
16
Views
6K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
29
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 65 ·
3
Replies
65
Views
7K