Low Budget Code Project 00: Conway’s Game Of Life

Howdy folks. Welcome to your first low budget code project. We’ll be creating Conway’s Game Of Life using the rules established by Coderetreat.  What makes this project great?

  • You can do this project in less than an hour
  • You can focus on learning a specific skill
  • Once you’re done, you’re done
  • You can do this project again and again

Our goal is to create Conway’s Game Of Life in 45 minutes. Once you hit the 45 minute mark you erase your code. That’s right, you toss it. Your main goal isn’t to focus on the final product; A true example of focusing on the journey over the destination.

What is Conway’s Game Of Life?

Gospers_glider_gun

 

Conway’s Game Of Life is a zero-player game played on an N x N grid. Each of the cells in the grid is considered to be alive or dead. Each of the cells are reviewed and updated at the same time. Every update creates a new generation, the state of the board at a particular time. The board gets updated forever creating an infinite amount of generations. The state of a cell on the board is determined by four rules:

  1. Any live cell with fewer than two live neighbors dies
  2. Any live cell with two or three live neighbors lives on to the next generation
  3. Any live cell with more than three live neighbours dies
  4. Any dead cell with exactly three live neighbours becomes a live cell

Where do I start?

You’ve got the base requirements on Conway’s Game Of Life, now you have to figure out what you want to do for your implementation. If you don’t have strong graphic skills consider generating a text file, JSON data, or an HTML table. This project doesn’t have to be pretty, so choose something you are comfortable with. Next choose a skill you want to hone in on. It can be as simple as “code better” to as complex as “work in a true TDD fashion” or “keep everything functional”. Here are a few ideas to help you get started.
Think of this project as your very own short film. It’s something that has a small scope, but you can be as creative as you want with the constraints. Here are a few shorts to check out before you start your project.

 

Goal Suggestions on how Goes Well With
Learn a new language Do the project in a new language, and don’t care if you finish Bedhead
Learn the latest JavaScript Framework Create your project in Angular / Ember / React Too Many Cooks (I know, not a short, but it feels appropriate)
Get better at data structures Try different ways to store your grid (One dimensional array, Two dimensional array, Hash table ) Frankenweenie
Learn about functional programing Do it in Haskell Luxo Jr.

Get Coding

That’s it. Set a 45 minute timer and get coding. Once you finish take a snap shot of your final product in action

My Finished Product

ConwaysI went over the 45 minute period to tweak my output. I decided to go with a simple text representation so I wouldn’t have to worry about rendering graphics. I hit a few stumbling points when it came to checking neighbors. I was getting “Out of bounds” exceptions when I checked any cell on the outer parameter. My other big take away was I probably should have came up with a better way to find a cell’s neighbors. I ended up with 8 methods to get the cells neighbors. I probably should of had one with the displacement from the original cell. I could probably include one set of logic to make sure I am in bounds.  I’ll try that the next time.

Your Finished Product

How did your finished product come out? Did you even finish? When I tried this at a Coderetreat my partner and I had mixed results. One time we only got unit tests set up and passing. In another we had a text file, but the logic was off.  Each run got better and better. Leave a post in the comments and let me know how you did.
Don’t hesitate to try this project again. This is a great