HACKER Q&A
📣 anderspitman

Share your Game of Life implementations


I know John Conway wasn't always fond of being known for GoL[0], but that doesn't make it any less important to me. I suspect for many, Life represents their first magical experience with programming. It can give the sense that you're glimpsing a connection to the deeper underpinnings of the universe. For me personally, Life has played a big role in my love of automata, and simulations in general.

I thought it would be fun for everyone to share their personal implementations of Life. Here are my meager contributions:

Recent hand-written wasm implementation (ui incomplete): https://github.com/anderspitman/wasm-life

Basic JavaScript/CSS intended to be used as self-contained animated icons: https://anderspitman.net/apps/golicons/

WebGL (for simulation and visualization) (unfinished): https://github.com/anderspitman/mogol/tree/webgl-sim

Two of my favorites that I didn't do:

Life in Life: https://www.youtube.com/watch?v=xP5-iIeKXE8

Life in WebGL: https://www.shadertoy.com/view/Xd33WS

[0]: https://youtu.be/E8kUJL04ELA


  👤 BZH314 Accepted Answer ✓
Twitch Plays Conway's Game Of Life is back, in memory of John Conway [1]

It's a multiplayer implementation you play through the Twitch chat by sending commands (!ON, !OFF, !RLE, !HELP, ...).

The list of commands and help: [2]

You can use/learn more complex patterns with RLEs (Run Length Encoded), where a "o" means alive, "b" means dead and "$" is carriage return.

Example of RLE command for a glider: !rle bob$2bo$3o! 0.0 # Create a glider at coordinates 0,0

TPCGOL has a database of 446 patterns (Sir Robin, Gosper Glider Gun, ..), so the equivalent command for the glider above is:

!glider 0.0

A slideshow of all 446 patterns (still lifes, oscillators, guns and spaceships) is available here: https://www.youtube.com/watch?v=u4XgALyX6w8

You can find more patterns on the Conway Life wiki [3]

There's also a Battle Royale mode you can start with !PLAY [4]

In Battle Royale mode, the rules are similar to Fortnite: join a game with !PLAY, !THANK the bus driver, and try to be the last one to have cells alive as the storm shrinks.

RIP John Conway

----

[1] https://www.twitch.tv/bzh314

[2] https://bzh314.com/twitch_plays_conway_game_of_life/

[3] http://www.conwaylife.com/wiki/Main_Page

[4] https://bzh314.com/twitch_plays_conway_game_of_life/#play


👤 ArneVogel
I played around a lot with cellular automata over a year ago and made the general case for game of life [1] but also other variants [2] and [3] which I consider especially beautiful.

[1] https://www.arnevogel.com/life-like-cellular-automaton/ [2] https://www.arnevogel.com/brians-brain-cellular-automaton/ [3] https://www.arnevogel.com/cyclic-cellular-automaton/


👤 waspentalive
Back in the days of s100 computers, I had a poly 88. I wrote a game-of-life that used the video memory as the cell array. characters meant a dead cell that next gen would be live, dead -> dead, live -> dead, live->live - one pass replaced the current generation with one of those 4 chars. The second pass would resolve the chars back to Live "@" and dead "." cells. 8080 Machine code (hand assembled). It would do about 1 generation a second. The life array was 40x25..

👤 Raed667
A very rough JavaScript implementation I did this morning after looking at the Wikipedia page

https://gist.github.com/RaedsLab/e4d5eed8f1d7e0b90f407bdef71...


👤 kapilkaisare
This is something I put together 5 years ago:

https://github.com/kapilkaisare/game-of-life