Hello again WASM
How fast time flies by! I’ve wanted to pick up writing something targeting WASM again but didn’t make the time until now. The last project was from 2023 - a simple game called stereo-glitch1. Last time I wrote something in Rust targeting WASM and the whole experience was quite fun so I figured I’d do it again - but this time in a way that can be easily included in this blog. I didn’t have any good idea what I should implement, so I just went with the Game of Life from the WASM & Rust tutorial2.
Conway’s Game of Life
The tutorial explains how to write the classic Game of Life3. In the game every cell is either alive or dead. In every update step of the universe a cell looks at its eight neighboring cells and depending on the number of dead and alive cells switches its state to either alive or dead.4
These simple rules are enough to create very intricate patterns and it is quite fun to play with it.
Here is a simple interactive demo of the game: (With the code from the tutorial plus some after-glow effects)
Sources and Annotations
Footnotes
-
Stereo Glitch. You can play it for free here: https://stereo-glitch.simonschlegl.com ↩
-
Rust and WebAssembly: Tutorial: Conway’s Game of Life. https://rustwasm.github.io/book/game-of-life/introduction.html ↩
-
CONWAY, John, et al. The game of life. Scientific American, 1970, 223.4: 4. ↩
-
Conway’s Game of Life Rules. Wikipedia: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life ↩