title: Recursive Stackoverflow Error
body: <p>Alright, so I'm trying to make a Java program to solve a picross board, but I keep getting a Stackoverflow error. I'm currently just teaching myself a little Java, and so I like to use the things I know rather than finding a solution online, although my way is obviously not as efficient. The only way I could think of solving this was through a type of brute force, trying every possibility. The thing is, I know that this function works because it works for smaller sized boards, the only problem is that with larger boards, I tend to get errors before the function finishes.</p>
  
  <p>so <code>char[][] a</code> is just the game board with all the X's and O's. <code>int[][] b</code> is an array with the numbers assigned for the picross board like the numbers on the top and to the left of the game. <code>isDone()</code> just checks if the board matches up with the given numbers, and <code>shift()</code> shifts one column down. I didn't want to paste my entire program, so if you need more information, let me know. Thanks!</p>
  
  <p>I added the code for shift since someone asked. Shift just moves all the chars in one row up one cell.</p>
  
  <p>Update: I'm thinking that maybe my code isn't spinning through every combination, and so it skips over the correct answer. Can anyone verify is this is actually trying every possible combination? Because that would explain why I'm getting stackoverflow errors. On the other hand though, how many iterations can this go through before it's too much?</p>
  
  <pre><code>public static void shifter(char[][] a, int[][] b, int[] clockwork)
  {
      boolean correct = true;
  
      correct = isDone(a, b);
  
      if(correct)
          return;
  
      clockwork[a[0].length - 1]++;
  
          for(int x = a[0].length - 1; x &gt; 0; x--)
          {
              if(clockwork[x] &gt; a.length)
              {
                  shift(a, x - 1);
  
                  clockwork[x - 1]++;
                  clockwork[x] = 1;
              }
  
              correct = isDone(a, b);
  
              if(correct)
                  return;
          }
  
      shift(a, a[0].length - 1);
  
      correct = isDone(a, b);
  
      if(correct)
          return;
  
      shifter(a, b, clockwork);
  
      return;
  }
  
  public static char[][] shift(char[][] a, int y)
  {       
          char temp = a[0][y];
  
              for(int shifter = 0; shifter &lt; a.length - 1; shifter++)
              {
                  a[shifter][y] = a[shifter + 1][y];
              }
  
          a[a.length - 1][y] = temp;
  
      return a;
  }
  </code></pre>