title: Optimal solution for Reve's puzzle using recursion
body: <p>I am trying to figure out how to print out the steps for solving the optimal Reve's puzzle, but I can't seem to figure out the correct reduction step for the recursion.</p>
  
  <p>The reve's puzzle is essentially an extension of the Hanoi problem but with 4 pegs instead of 3. 
  More information here: <a href="https://everything2.com/title/Reve%2527s+puzzle" rel="nofollow noreferrer">https://everything2.com/title/Reve%2527s+puzzle</a></p>
  
  <p>The frame-stewart conjecture says that the k value is k= n+1-sqrt(2*n-1), where n is the total amount of discs we have to move.
  The step I can't figure out is the recursion for 4 pegs instead of 3. My code for 3 pegs is:</p>
  
  <pre><code>private static void revesStepThree(int n, int topDisc, String from, String temp, String to) {
          if (n == topDisc) return;
          revesStepThree(n - 1, topDisc, from, to, temp);
          System.out.println("Move disc " + n + " from " + from + " to " + to);
          revesStepThree(n - 1, topDisc, temp, from, to);
  
      }
  </code></pre>
  
  <p>How can I modify this to work for 4 pegs? Essentially, from the link above, I don't understand steps 1 and 3 (which are pretty much the same step except with different pegs).</p>