Show HN: Conway's Game of Life in JavaScript with efficient implementation
1 gkoos 1 8/2/2025, 5:08:35 PM github.com ↗
I built a Conway’s Game of Life implementation in plain JavaScript with no frameworks or dependencies. The code is modular and easy to follow, with a focus on performance and clarity.
The project is intended as a clean example of how to implement cellular automata with modern JS, optimized for speed but easy to understand and extend.
Live demo: https://gkoos.github.io/conway/ GitHub repo: https://github.com/gkoos/conway
Would love feedback on the code structure, algorithm efficiency, or any suggestions you might have!
Comments (1)
cryptoalex · 10h ago
Congrats! Nicely done! Conway's Game of Life was my first attempt at assembly programing for a self-soldered ZX Spectrum's Z-80 CPU clocked at 3.5 Mhz. Compiled to 383-byte long binary, managed to do about 100 generations per second for a 3-cell blinker oscillator. My friend did a naive BASIC version brute forcing every single pixel on the screen, doing about 1 generation per 2 minutes. I started from BASIC version doing about 1 generation per 3 seconds. The main algo optimization was to have a list of active cells and only processing directly adjacent cells, and ignoring the majority of unpopulated white space. The next optimization was moving cells processing to assembly (the 383 bytes module). It was also toroid-shaped field, exactly like in your implementation. We had a lot of fun watching all those oscillators and guns producing gliders.