Welcome to another Mini Code Adventure, an attempt to highlight fun programming projects that you can get started in minutes.
This week we’re starting with the maze code we wrote last time, and using the game-of-life-logic npm package to demonstrate Conway’s Game of Life.
The rules of the game are simple, we start with a matrix of booleans and then change the state of each cell based on the number of it’s neighbors:
- Any live cell with fewer than two live neighbors dies, as if caused by underpopulation.
- Any live cell with two or three live neighbors lives on to the next generation.
- Any live cell with more than three live neighbors dies, as if by overpopulation.
- Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
Video: https://www.youtube.com/watch?v=x5n5QlxLzLU
Live Demo: https://codingblocks.github.io/mini-code-adventures-game-of-life/dist/
Code on Github: https://github.com/codingblocks/mini-code-adventures-game-of-life