Golly Help: Bounded Grids

Bounded grids with various topologies can be created by adding a special suffix to the usual rule string. For example, B3/S23:T30,20 creates a toroidal Life universe 30 cells wide and 20 cells high. The suffix syntax is best illustrated by these examples:

  :P30,20 |  | — plane with width 30 and height 20
  :P30,0 |  | — plane with width 30 and infinite height
  :T0,20 |  | — tube with infinite width and height 20
  :T30,20 |  | — torus with width 30 and height 20
  :T30+5,20 |  | — torus with a shift of +5 on the horizontal edges
  :T30,20-2 |  | — torus with a shift of -2 on the vertical edges
  :K30*,20 |  | — Klein bottle with the horizontal edges twisted
  :K30,20* |  | — Klein bottle with the vertical edges twisted
  :K30*+1,20 |  | — Klein bottle with a shift on the horizontal edges
  :C30,20 |  | — cross-surface (horizontal and vertical edges are twisted)
  :S30 |  | — sphere with width 30 and height 30 (must be equal)

Some notes:

- The first letter indicating the topology can be entered in lowercase but is always uppercase in the canonical string returned by the getrule() script command.
- If a bounded grid has width w and height h then the cell in the top left corner has coordinates -int(w/2),-int(h/2).
- The maximum width or height of a bounded grid is 2,000,000,000.
- Use 0 to specify an infinite width or height (but not possible for a Klein bottle, cross-surface or sphere). Shifting is not allowed if either dimension is infinite.
- Pattern generation in a bounded grid is slower than in an unbounded grid. This is because all the current algorithms have been designed to work with unbounded grids, so Golly has to do extra work to create the illusion of a bounded grid.

The different topologies are described in the following sections.

Plane

A bounded plane is a simple, flat surface with no curvature. When generating patterns in a plane, Golly ensures that all the cells neighboring the edges are set to state 0 before applying the transition rules, as in this example of a 4 by 3 plane:

  `0` | `0` | `0` | `0` | `0` | `0`
  `0` | `A` | `B` | `C` | `D` | `0`
  `0` | `E` | `F` | `G` | `H` | `0`
  `0` | `I` | `J` | `K` | `L` | `0`
  `0` | `0` | `0` | `0` | `0` | `0`
  | rule suffix is :P4,3

Torus

If the opposite edges of a bounded plane are joined then the result is a donut-shaped surface called a torus. Before applying the transition rules at each generation, Golly copies the states of edge cells into appropriate neighboring cells outside the grid. The following diagram of a 4 by 3 torus shows how the edges are joined:

  `L` | `I` | `J` | `K` | `L` | `I`
  `D` | `A` | `B` | `C` | `D` | `A`
  `H` | `E` | `F` | `G` | `H` | `E`
  `L` | `I` | `J` | `K` | `L` | `I`
  `D` | `A` | `B` | `C` | `D` | `A`
  | rule suffix is :T4,3

A torus can have a shift on the horizontal edges or the vertical edges, but not both. These two examples show how shifted edges are joined:

  `K` | `L` | `I` | `J` | `K` | `L`
  `D` | `A` | `B` | `C` | `D` | `A`
  `H` | `E` | `F` | `G` | `H` | `E`
  `L` | `I` | `J` | `K` | `L` | `I`
  `A` | `B` | `C` | `D` | `A` | `B`
  | :T4+1,3
  `H` | `I` | `J` | `K` | `L` | `A`
  `L` | `A` | `B` | `C` | `D` | `E`
  `D` | `E` | `F` | `G` | `H` | `I`
  `H` | `I` | `J` | `K` | `L` | `A`
  `L` | `A` | `B` | `C` | `D` | `E`
  | :T4,3+1

Klein bottle

If one pair of opposite edges are twisted 180 degrees (ie. reversed) before being joined then the result is a Klein bottle. Here are examples of a horizontal twist and a vertical twist:

  `I` | `L` | `K` | `J` | `I` | `L`
  `D` | `A` | `B` | `C` | `D` | `A`
  `H` | `E` | `F` | `G` | `H` | `E`
  `L` | `I` | `J` | `K` | `L` | `I`
  `A` | `D` | `C` | `B` | `A` | `D`
  | :K4*,3
  `D` | `I` | `J` | `K` | `L` | `A`
  `L` | `A` | `B` | `C` | `D` | `I`
  `H` | `E` | `F` | `G` | `H` | `E`
  `D` | `I` | `J` | `K` | `L` | `A`
  `L` | `A` | `B` | `C` | `D` | `I`
  | :K4,3*

A Klein bottle can only have a shift on the twisted edges and only if that dimension has an even number of cells. Also, all shift amounts are equivalent to a shift of 1. Here are two examples:

  `J` | `I` | `L` | `K` | `J` | `I`
  `D` | `A` | `B` | `C` | `D` | `A`
  `H` | `E` | `F` | `G` | `H` | `E`
  `L` | `I` | `J` | `K` | `L` | `I`
  `B` | `A` | `D` | `C` | `B` | `A`
  | :K4*+1,3
  `F` | `J` | `K` | `L` | `D`
  `C` | `A` | `B` | `C` | `A`
  `L` | `D` | `E` | `F` | `J`
  `I` | `G` | `H` | `I` | `G`
  `F` | `J` | `K` | `L` | `D`
  `C` | `A` | `B` | `C` | `A`
  | :K3,4*+1

Cross-surface

If both pairs of opposite edges are twisted and joined then the result is a cross-surface (also known as a real projective plane, but Conway prefers the term cross-surface). Here's an example showing how the edges are joined:

  `A` | `L` | `K` | `J` | `I` | `D`
  `L` | `A` | `B` | `C` | `D` | `I`
  `H` | `E` | `F` | `G` | `H` | `E`
  `D` | `I` | `J` | `K` | `L` | `A`
  `I` | `D` | `C` | `B` | `A` | `L`
  | :C4,3

Note that the corner cells have themselves as one of their neighbors. Shifting is not possible.

Sphere

If adjacent edges are joined rather than opposite edges then the result is a sphere. By convention we join the top edge to the left edge and the right edge to the bottom edge, as shown in this 3 by 3 example:

  `A` | `A` | `D` | `G` | `C`
  `A` | `A` | `B` | `C` | `G`
  `B` | `D` | `E` | `F` | `H`
  `C` | `G` | `H` | `I` | `I`
  `G` | `C` | `F` | `I` | `I`
  | :S3

Note that the cells in the top left and bottom right corners (the "poles") have different neighborhoods to the cells in the top right and bottom left corners. Shifting is not possible.

Example patterns using the above topologies can be found in Patterns/Generations and Patterns/Life/Bounded-Grids.