liveBook · Manning

Embiggening

As explained in Fabulous Adventures in Data Structures and Algorithms

Embiggening is the operation of embedding an n-quad in the center of an otherwise empty (n+1)-quad.

Embiggening embeds an n-quad at the center of an otherwise empty (n+1)-quad. Each quadrant of the original becomes a corner subquad of the larger structure, leaving an empty ring around it. section 4.3.7

The operation is especially useful with immutable quadtrees: the surrounding empty subquads can all reference one shared empty object. At level zero it is invalid; at the maximum level it returns the existing quad. section 4.3.7

Keeping Life patterns away from the edge

HashLife embiggens a grid when its empty border is insufficient, steps the safely padded grid, and embiggens the result again. This maintains an invariant: living cells remain far from the boundary, so the represented grid does not shrink and can expand when a spaceship approaches an edge. section 4.4.3 section 4.4

Figure 4.8 A 2-quad is “embiggened” so that we have a 3-quad with the cells of the 2-quad in its center. Notice what happens to the northeast portion of the 2-quad when we place it in the 3-quad.

The figure traces how the northeast, northwest, southeast, and southwest portions of a 2-quad relocate inside the four quadrants of a 3-quad. section 4.3.7

    public void Step(int speed = 0) #1
    {
        IQuad current = cells;
        if (!current.HasAllEmptyEdges())
            current = current.Embiggen().Embiggen();
        else if (!current.Center().HasAllEmptyEdges())
            current = current.Embiggen(); #2
        IQuad next = Step(current); #3
        cells = next.Embiggen(); #4
    }

The Step implementation shows the two-stage padding test, recursive stepping, and final embiggening used to preserve the boundary invariant. section 4.4.3

How Fabulous Adventures in Data Structures and Algorithms covers it

How deep it goes
Defines quadrant relocation, immutable empty sharing, boundary cases, and integration with recursive stepping.
Examples
Uses a 2-quad becoming a centered 3-quad and a HashLife Step routine that pads, advances, and pads again.
What it assumes
Assumes quadtrees, n-quads, immutable nodes, and Conway’s Life grid behavior.
What you can do after
Build it from scratch as a C# quadtree helper and apply it to boundary management in HashLife.
How it connects
Connects quadtrees with immutable data structures, HashLife, Life grids, and recursive stepping.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fabulous Adventures in Data Structures and Algorithms. The section links point to the parts of the book it draws on.