Some generative images are interesting because their rules are difficult to discover. Hopalong is interesting because the central rule fits comfortably on a screen, and the image still takes time to understand.

Barry Martin's Hopalong recurrence repeatedly transforms a point in two dimensions. The Hopalong Redux project credits Iacopo Sassarini's original WebGL visualizer and Sam Leatherdale's updated implementation. I saved a fork because it is the kind of compact visual system I like returning to: simple inputs, long orbits and many possible appearances.

The basic recurrence is:

nextX = y - sign(x) * sqrt(abs(b * x - c))
nextY = a - x

The parameters a, b and c stay fixed while the point moves. Each new point becomes the input for the next step. Plot many points and structure emerges from repeated application of the same rule.

Preserve the old point

The most important implementation detail is easy to miss. Both new coordinates use the old coordinates. If x is overwritten before calculating nextY, the program is implementing a different recurrence.

This small JavaScript example returns points for the basic formula. It does not include the additional variants or the 3D presentation in the visualizer:

function hopalong(a, b, c, count) {
  let x = 0;
  let y = 0;
  const points = [];

  for (let i = 0; i < count; i += 1) {
    const nextX = y - Math.sign(x) * Math.sqrt(Math.abs(b * x - c));
    const nextY = a - x;
    x = nextX;
    y = nextY;
    points.push([x, y]);
  }
  return points;
}

The absolute value keeps the square root defined for real input. The sign term changes the direction of the contribution according to which side of the vertical axis the current point occupies. The exact behavior at zero is explicit here through Math.sign(0).

The drawing has parameters too

Generating points and presenting them are separate decisions. The same orbit can look sparse or dense depending on point size, opacity, scale and how many iterations are shown. Joining every point with a line produces a different visual emphasis from drawing isolated dots.

A long jump between consecutive points is not necessarily an error. The recurrence is not a physical particle simulation with a speed limit. Drawing a connecting segment can make that jump dominate the image, even when the distribution of visited points is the part that interests us.

Framing also changes interpretation. If every parameter change automatically rescales the orbit to fill the canvas, the overall shape remains visible, but differences in extent become harder to compare. A fixed scale makes those differences clear while allowing some orbits to move outside the view. A useful interface could offer both.

I would change one parameter at a time and preserve a few interesting settings. Randomizing all three is enjoyable, but a deliberate sweep teaches more about which structures persist and which reorganize abruptly. The aim is not to classify every possible orbit before enjoying one.

The appeal is the direct relationship between the rule and the image. There is no large asset collection hiding behind it. A few numbers establish a process, repetition gives it density, and rendering choices determine how clearly the pattern can be seen. That is enough material for a surprisingly rich visual toy.