@Override
  protected void doStep() {
    int steps = control.getInt("simulations per height");

    if (h > maxH) {
      control.calculationDone("max height reached");
      return;
    }

    resize();

    double rProb[] = new double[100];

    // abort on empty list
    for (int j = 0; j < steps; ++j) {

      int rVisited[] = new int[101];
      int rTotal[] = new int[101];

      refurbish();

      // count all probabilities
      for (int i = 0; i < p.length; ++i) {
        int bin = (int) Math.round(p[i] * 100);
        ++rTotal[bin];
      }

      while (true) {
        if (border.size() <= 0) {
          control.println("no border left");
          break;
        }

        // get lowest-probability cell on border
        int i = border.poll().value;

        // visit it
        // visited[i] = true;// already visited when adding to queue
        int bin = (int) Math.round(p[i] * 100);
        ++rVisited[bin];

        // add unvisited neighbors to cell
        addNeighbors(i);

        // paint it pink
        p[i] = -1;

        int x = getX(i);

        if (x == w - 1) {
          // control.println("right end reached");
          break;
        }
      }

      // apply to rProb

      for (int bin = 0; bin < 100; ++bin) {
        rProb[bin] += (double) rVisited[bin] / (double) rTotal[bin];
      }

      // lattice plot
      probFrame.setAll(p);
    }

    // apply to histPlot
    for (int bin = 0; bin < 100; ++bin) {
      histPlot.append(histIndex, bin / 100.0, rProb[bin] / 100);
    }
    ++histIndex;

    // set next size
    h = (int) Math.floor(h * stepH);
  }