Seeing Machines : Conway's Game of Life

Feb 8, 2025

Cellular automata simulation

In 1970, mathematician John Conway introduced the Game of Life - a deceptively simple cellular automaton that demonstrates how complex patterns can emerge from basic rules. The game operates on a 2D grid where cells live or die based on their neighbours, following three fundamental rules: isolation (too few neighbors leads to death), overcrowding (too many neighbours causes death), and reproduction (dead cells with exactly three neighbours spring to life).

Despite its simplicity, the Game of Life can generate intricate patterns, from simple oscillators to complex "spaceships" that glide across the grid. This emergent behavior made it a fascinating study in computational mathematics and complexity theory.

For our Seeing Machines assignment, we were tasked with recreating Conway's Game of Life using openFrameworks, with freedom to interpret its visual representation. While the original used simple black and white squares, I saw an opportunity to reimagine this classic cellular automaton in isometric space.

Original Game of Life

Design Process

My sketches show the evolution from traditional Game of Life to an isometric interpretation. Starting with the classic grid (top left), I explored using circular elements to represent cells, but this posed visualization challenges for state transitions.

I also I explored using dotted lines instead of solid grid lines, aiming to create a lighter, more organic feel that better represented the "life" aspect of the simulation.

I finally settled with the idea of turning it into an isometric projection. By transforming the 2D grid into isometric space, cells could appear to float in a 3D environment while maintaining their 2D relationship. I added dots at intersections to ground the cells visually and used rhomboid shapes for living cells to enhance the 3D effect.

Process Sketches I used to develop my idea

Implementation Details

My development process started with breaking down Conway's Game of Life into its fundamental components, first in plain language, then working with AI to understand how these concepts would translate into C++ and openFrameworks.

Here's how the logic evolved:

CORE GAME LOGIC
Initialize:
    Create 2D array for cell states
    Populate with random alive/dead cells (30% alive)
    Set up visual properties (orange for alive, green for grid)
    
Main Loop:
    For every cell position (x,y):
        Count live neighbors:
            Check all 8 surrounding cells
            Track count of alive cells
            Handle edge cases
            
        Apply Conway's Rules:
            If cell is alive:
                Dies if < 2 neighbors (isolation)
                Dies if > 3 neighbors (overcrowding)
                Stays alive if 2-3 neighbors
            If cell is dead:
                Becomes alive if exactly 3 neighbors
    
    Update visualization:
        Transform grid coordinates to isometric
        Draw grid lines with dots at intersections
        Draw rhomboid shapes for living cells

This was then structured for openFrameworks:

main.cpp:
    Set up window (1024x768)            // Window initialization
    Create new game instance            // Program start

ofApp.h:
    Class Properties:
        ofImage grid                     // Stores cell states
        gridWidth/Height (20x20)         // Grid dimensions
        cellSize (30)                    // Visual scaling
        Colors for alive/dead            // Visual theming
        isPaused flag                    // Game state
    
    Function Declarations:
        setup()                          // Initial configuration
        update()                         // Game logic
        draw()                           // Rendering
        countNeighbors()                // Cell state helper
        drawIsometricCell()             // Visualization helper
        handleInput()                   // User interaction

ofApp.cpp:
    setup():
        Configure frame rate
        Initialize grid
        Set colors
        Generate random start state

    update():
        Check pause state
        Create next generation grid
        Apply Conway's rules
        Update cell states

    draw():
        Clear background
        Draw UI instructions
        Calculate isometric positions
        Render grid lines and cells

    Input Handlers:
        Space -> Pause/Resume
        R -> Random reset
        C -> Clear grid
        Mouse -> Toggle cells

Working with AI helped me understand how to translate these concepts into actual code, particularly with the isometric transformations and efficient state management.

Final sketch

My isometric interpretation of Conway's Game of Life runs on a 20x20 grid, transforming the traditional flat visualization into a dynamic three-dimensional space. Living cells emerge as orange rhomboids floating above a green gridded plane, marked by intersection nodes that ground the visualization in space.

The simulation responds to simple controls - space to pause, 'R' to randomize, and 'C' to clear the grid. Users can craft their own patterns by clicking cells directly, watching as complex behaviors emerge from these simple interactions.

Source code available on GitHub: [GitHub Link]

This was a fun way to reimagine Conway's mathematical elegance while adding visual depth, creating a fresh perspective on this classic cellular automaton.

References
  1. Claude by Anthropic
  2. Conway's Game of Life
  3. Assignment Brief

You can email me here. I’m pretty active on Twitter, occasionally pop into LinkedIn, and surfing the internet through Are.na.

©2019-2025 SURYA NARREDDI.

You can email me here. I’m pretty active on Twitter, occasionally pop into LinkedIn, and surfing the internet through Are.na.

©2019-2025 SURYA NARREDDI.