The Game of Life in HTML5

Conway’s Game of Life is a pretty sweet game. Well, it’s more like a set of rules that, when run, can result in some pretty awesome patterns.

Simply put, you start with a grid of boxes. The boxes are in either of two states: alive or dead. To play the game, you start by turning some boxes alive, and running these rules over and over:

  • A living cell with 0 or 1 neighbours dies, by underpopulation
  • A living cell with 4 or more neighbours dies, by overpopulation
  • A living cell with 2 or 3 neighbours survives
  • A dead cell with 3 or more neighbours becomes alive, by reproduction

I’m not sure why, but we learned about the Game of Life in one of my computer science classes a few semesters ago. I thought it was interesting at the time, but it (sort of) came in handy when I interned at Microsoft. Every year the company puts on “Puzzle Day” which is a program-wide competition between teams that are solving puzzles all day. One of the puzzles was just a wide grid with seemingly random boxes colored black. It came with some clue about “life”, and I figured that it was simply Conway’s Game. Little did I know that there were custom rules that we had to figure out to solve what the boxes revealed… Sadly, this wasn’t one of the puzzles we solved, but we came close, right?

Conway’s Game of Life in HTML5

Leave a Reply

Your email address will not be published. Required fields are marked *