About This Automata Simulator
What are Cellular Automata?
Cellular Automata (CA) are fascinating computational models that consist of a grid of cells, each in a specific state (like "on/alive" or "off/dead"). The state of each cell evolves over discrete time steps (generations) according to a fixed set of rules. These rules are based on the states of the cell's immediate neighbors. Despite their simplicity, CAs can produce incredibly complex and often beautiful patterns, demonstrating how intricate behaviors can emerge from simple local interactions.
This simulator allows you to explore these emergent behaviors in both 1-dimensional and 2-dimensional CAs.
2D Cellular Automata
In 2D CAs, cells are arranged on a grid, and the state of a cell in the next generation is typically determined by the states of its eight surrounding neighbors (the Moore neighborhood). The rules are commonly expressed in "B/S" (Birth/Survival) notation:
- B_x_: A dead cell is "Born" (becomes alive) if it has exactly _x_ live neighbors.
- S_y_: A live cell "Survives" (remains alive) if it has exactly _y_ live neighbors.
- If neither condition is met, a live cell dies (from loneliness or overpopulation), or a dead cell remains dead.
Available 2D Rulesets:
- Conway's Game of Life (B3/S23): The most famous CA. Dead cells with 3 live neighbors are born. Live cells with 2 or 3 live neighbors survive. This rule leads to a rich variety of patterns, including:
- Still Lifes: Stable patterns (e.g., Block, Beehive, Loaf, Tub).
- Oscillators: Patterns that repeat over a fixed period (e.g., Blinker, Toad, Pulsar, Pentadecathlon).
- Spaceships: Patterns that move across the grid (e.g., Glider, Lightweight Spaceship - LWSS).
- Guns: Patterns that periodically create spaceships (e.g., Gosper Glider Gun).
- HighLife (B36/S23): A variation where dead cells are born with 3 or 6 live neighbors, and live cells survive with 2 or 3. Known for producing "replicator" patterns.
- Seeds (B2/S): Every live cell dies in each generation. Dead cells are born if they have exactly 2 live neighbors. This rule often leads to explosive, symmetrical growth that eventually fades.
- Day & Night (B3678/S34678): A symmetric rule where cells are born with 3, 6, 7, or 8 neighbors and survive with 3, 4, 6, 7, or 8 neighbors. It often produces stable or oscillating patterns with a more "filled-in" appearance.
1D Elementary Cellular Automata
1D CAs operate on a single line of cells. In "elementary" CAs:
- The state of a cell in the next generation is determined by its current state and the states of its immediate left and right neighbors (a 3-cell neighborhood).
- There are $2^3 = 8$ possible patterns for this 3-cell neighborhood (e.g., 111, 110, 101, ..., 000, where 1 is alive and 0 is dead).
- A rule specifies the outcome (0 or 1) for each of these 8 patterns. Listing these 8 outcomes (e.g., for 111, 110, ..., 000) as an 8-bit binary number gives the "Rule number" (0-255), also known as the Wolfram code. For example, Rule 30 in binary is 00011110.
- Stephen Wolfram classified these rules by their behavior:
- Class 1 (Uniform): Evolves to a fixed, homogeneous state (e.g., Rule 0, Rule 255). All cells become dead or all become alive.
- Class 2 (Periodic): Evolves to simple repeating, periodic structures (e.g., Rule 90, Rule 150). Often creates nested or fractal-like patterns.
- Class 3 (Chaotic): Produces seemingly random or chaotic patterns, often with no discernible order (e.g., Rule 30, Rule 45).
- Class 4 (Complex): Produces complex patterns with localized structures that can interact in intricate ways. Some are believed to be capable of universal computation (e.g., Rule 110).
Simulator Features Guide
- Simulation Tabs:
- 2D Automata (Standard): A responsive 2D grid. You can now also set custom column/row counts for this grid.
- 2D Custom Grid: Define exact grid dimensions (columns, rows) and cell size for a fixed-size 2D simulation.
- 1D Automata: Explore 1D elementary cellular automata.
- Core Controls (All Panels):
- Start/Stop: Begin or pause the simulation.
- Reset: Clears the grid and resets generation/population counts. For Standard 2D, also reverts to responsive grid sizing if custom dimensions were set.
- Clear Cells: Empties the grid of live cells without resetting generation count or other settings.
- Randomize: Populates the grid (or initial 1D row) with a random distribution of live cells.
- Step (1D Only): Advance the 1D simulation by a single generation.
- Visual Customization:
- Cell Shape: Choose to display live cells as "Squares" or "Circles" using the selector in the header.
- Themes: Select from various visual themes. Some themes include background textures for live cells.
- Texture Mapping: Choose how textures are applied:
- Tile Texture: The texture image is tiled across the canvas, and cells reveal portions of this continuous pattern.
- Random Sample: Each live cell gets a unique, randomly selected portion of the texture image. This can create more varied and less uniform textured effects.
- Pattern Management (2D & 1D):
- Predefined Patterns (2D): Load classic patterns like Gliders, Pulsars, etc.
- Save/Load: Save your own custom patterns (for 2D grids) or initial 1D rows.
- To Browser: Saves to your browser's local storage (persistent on your machine).
- To Cloud: Saves to Firebase (requires authentication, allows access across devices if logged in).
- Specific Panel Features:
- Standard 2D Grid Size: Input desired column and row counts and click "Apply Grid Size" to override the default responsive behavior. "Reset Grid" restores responsiveness.
- Custom 2D Grid: Set columns, rows, and cell pixel size. The canvas will be fixed to these dimensions and scrollable if it exceeds the view.
- 1D Rule Input: Enter a Wolfram code (0-255) for the 1D simulation.
- 1D Initial State: Select "Single Cell", "Random", or "Custom" (click cells in Generation 0 when paused/reset).