Microsoft MakeCode

Game of life... ish

I know, I know… it’s been done several times already. … but here’s my take on a Game of Life simulation in makecode arcade:


D-pad: move cursor
A: toggle cell (hold while pressing directions to keep drawing)
B: Start/stop simulation
Menu: opens a list of preset layouts that you can choose from

Conway’s Game of Life takes place on an infinite grid. I made no attempt to approximate that behavior. Cells on the boundary are highlighted yellow to indicate they’re not behaving like they would on a proper infinite grid.

I’m reading from / writing to the background image a lot. I have no idea if this is an anti-pattern.

I am fond of how I used the image editor to build/save the presets. That workflow on the development side was pretty nice.

This was my first makecode JS project. I’m still trying to figure out how to modularize my code; sorry if it seems poorly organized.


Thanks - RIP Conway

wait i’m so confused, who is conway, how do you play, is there points or a goal?

1 Like

Ha. Sorry this is confusing! :sweat_smile: There’s already been a lot written about this, and if you’re interested you should definitely read some more about it, but I’ll give a shot at a brief explanation:

Conway was a mathematician (who recently passed away). He invented this “game” but it’s not really one that has score or points.

The “game” takes place on a grid (think of a piece of graph paper). You can fill in any cells (squares on the graph paper) you want.

The next step is to figure out the next generation. For each cell, you look at its 8 neighbors.

If the cell you’re starting at is “alive” (filled in), it stays alive in the next generation if it has exactly two or three live neighbors (fewer than two and it dies from loneliness; more than three it dies from over crowding).

If the cell you’re starting from is “dead”, it comes to life in the next generation if it has exactly three live neighbors.

Once you’ve done this for every cell, you’re done. You’ve computed a new generation. You can repeatedly produce new generations as many times as you want.

As you can imagine, computers are pretty good at playing this game…

People have found some very interesting patterns (some of which I included in the Menu): some that are stable, or oscillate, or move across the grid, or produce new children… there are even some self-replicating patterns (though this grid is too small to showcase those).

In this version, you’re free to draw around on the grid (A button will draw while the game isn’t running). You can play around with seeing how your own patterns evolve. Or you can load up one of the preconfigured ones and tweak it. There’s even one preset that will just randomly fill the grid with 30% live cells. The reset button will reset to whatever pattern you last selected (though it will lose any customizations you made).

If you find it fun, or interesting, or want to see some more examples of patterns, the wikipedia page is probably a good start:'s_Game_of_Life

thx, it makes sense now

Ah well, you can google John Conway mathematician. Covid took his life.

Nice! I made an implementation of Conway’s game of life a while back too, it’s under the Graphics and Math carousel (the codes very ugly though; I spent a while whittling it down / inlining things to get it to work properly on hardware, and should probably go back and clean it up / ideally some of the hackiness is no longer required).

I definitely like that yours has a cursor / can be customized in the simulator. It’s also nice that it’s zoomed in, rather than one cell == one pixel. Might steal some ideas from this version and update might a bit, if that’s all right with you :slight_smile:.

1 Like


Also, If when you’re looking at it, you have any feedback on the code, I’d love to hear it!

R.I.P. John

1 Like

I love your menu with the different patterns. I while ago coded a version with blocks that starts with a random configuration treating each pixel on the screen as a cell and with toroidal boundary conditions. Here it is: