title: Terrain/Mountain algorithm not working as intended
body: <p>I want to create a terrain with a mountain on it, using a very basic principle, shown by this height mapping:</p>
  
  <pre><code>0 0 0 0 0 0 0 0 0 0 0
  0 0 0 0 0 0 0 0 0 0 0
  0 0 0 0 0 1 0 0 0 0 0
  0 0 0 0 1 2 1 0 0 0 0
  0 0 0 1 2 3 2 1 0 0 0
  0 0 1 2 3 4 3 2 1 0 0
  0 0 0 1 2 3 2 1 0 0 0
  0 0 0 0 1 2 1 0 0 0 0
  0 0 0 0 0 1 0 0 0 0 0
  0 0 0 0 0 0 0 0 0 0 0
  0 0 0 0 0 0 0 0 0 0 0
  </code></pre>
  
  <p>It starts at a random point with <code>height = 4</code>, and then gradually decreases it amonst the neighbours.</p>
  
  <p>The recursive idea is simple, I start a point, recurse to the top/down/left/right with <code>height - 1</code> (in this example), and only if not encountered yet, I set their values.</p>
  
  <p>I implemented it as follows:</p>
  
  <pre><code>private void createMountain(final float[][] heightMapping, final float startHeight) {
      boolean[][] traversed = new boolean[width][depth];
      boolean positive = (startHeight &gt;= 0f);
      int x = random.nextInt(width);
      int z = random.nextInt(depth);
      recursiveUpdate(heightMapping, traversed, x, z, startHeight, positive);
  }
  
  private void recursiveUpdate(final float[][] heightMapping, final boolean[][] traversed, final int x, final int z, final float startHeight, final boolean positive) {
      if (x &lt; 0 || x &gt;= width || z &lt; 0 || z &gt;= depth) {
          return;
      }
      if (traversed[x][z]) {
          return;
      }
      if ((positive &amp;&amp; startHeight &lt;= 0f) || (!positive &amp;&amp; startHeight &gt;= 0f)) {
          heightMapping[x][z] = 0f;
          return;
      }
      traversed[x][z] = true;
      heightMapping[x][z] = startHeight;
      recursiveUpdate(heightMapping, traversed, x, z - 1, calculateNewStartHeight(startHeight, positive), positive);
      recursiveUpdate(heightMapping, traversed, x, z + 1, calculateNewStartHeight(startHeight, positive), positive);
      recursiveUpdate(heightMapping, traversed, x - 1, z, calculateNewStartHeight(startHeight, positive), positive);
      recursiveUpdate(heightMapping, traversed, x + 1, z, calculateNewStartHeight(startHeight, positive), positive);
  }
  
  private float calculateNewStartHeight(final float startHeight, final boolean positive) {
      float delta = startHeight / maxDecayFactor;
      return (positive) ? startHeight - delta : startHeight + delta;
  }
  </code></pre>
  
  <p>However it gives me the following output:</p>
  
  <pre><code>0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.1  
  1.9  1.6  1.2  1.0  0.8  0.6  0.5  0.4  0.3  0.3  0.2  0.2  0.1  0.1  0.1  0.1  
  2.4  3.0  3.8  4.7  5.9  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.1 
  </code></pre>
  
  <p>With the issue being that it forms a line now, which was not my intention, instead of gradually smoothing out.</p>
  
  <p>How can I implement my desired algorithm?</p>