Game of Life by John Conway

Inspiration

The inspiration for this project came from John Conway's "Game of Life," a captivating example of cellular automata that demonstrates how complex patterns can emerge from simple rules. I was fascinated by the way this concept merges mathematics, programming, and visualization to create something truly mesmerizing.

What it does

The project simulates Conway's Game of Life, where a grid of cells evolves over time based on simple rules:

  • A live cell with fewer than two live neighbors dies (underpopulation).
  • A live cell with two or three live neighbors lives on to the next generation.
  • A live cell with more than three live neighbors dies (overpopulation).
  • A dead cell with exactly three live neighbors becomes alive (reproduction).

The user can interact with the grid to create initial configurations and watch how they evolve dynamically.

How we built it

I built the project using:

  • p5.js: For rendering the grid and handling interactions. Working with p5.js was both exciting and challenging as it required learning how to efficiently draw and update the grid.
  • HTML, CSS, and JavaScript: For structuring the project, styling the interface, and implementing the game logic.

The project involves:

  1. Drawing a grid of cells.
  2. Applying the Game of Life rules in real time.
  3. Providing user interactions like toggling cells on/off and starting/stopping the simulation.

Challenges we ran into

One major challenge was optimizing the simulation for larger grids. Rendering and updating thousands of cells in real-time required careful consideration of performance in p5.js. Debugging the game logic was another hurdle, as even small errors in the implementation could lead to unexpected outcomes.

Accomplishments that we're proud of

  • Successfully implementing the rules of the Game of Life and creating a visually appealing, interactive simulation.
  • Gaining a deeper understanding of cellular automata and improving my problem-solving skills through debugging and optimization.
  • Making the project accessible and engaging for users.

What we learned

This project taught me:

  • The importance of optimizing code for performance, especially when working with animations or real-time updates.
  • How to use p5.js effectively for creative coding.
  • The beauty of simple mathematical concepts and their applications in programming and design.

What's next for Game Of Life

  • Enhanced Interactions: Adding more customization options for the grid size, speed, and color schemes.
  • Advanced Patterns: Including pre-defined patterns like oscillators, gliders, and spaceships for users to explore.
  • Educational Mode: Creating a mode to teach users about cellular automata and Conway's Game of Life.
  • Mobile Compatibility: Optimizing the project for mobile devices to reach a broader audience.

Try it out

You can explore and interact with the project here:
Game of Life by John Conway

Built With

Share this project:

Updates