Programming Conway’s Game of Life

Introduction #

In my latest series of YouTube videos, I demonstrate how to program Conway’s Game of Life in C#. Although I try to provide as much explanation as I can during the videos, this series is probably best for beginners who already have already gotten their feet wet with things like variables and decision structures.

View the series “Programming Conway’s Game of Life in C#” on YouTube.

Download the code for this project from Github.

Click to view the entire series on YouTube.

Still, even if you’re a complete beginner, you should get an appreciation from the series of how an application is designed from start to finish. I show how such a task is broken down into steps that can be handled one at a time. The first video focuses on getting the initial program running and the following videos show the process of working the bugs and inefficiencies out of the code to make the program run faster and add more features.

Conway’s Game of Life is a fun little simulation game featuring a grid of cells where the cells live or die based on a few simple rules. Surprisingly complex patterns result. It was first developed by mathematician John Conway at Cambridge University in 1970 to show how complex processes, even consciousness, might arise from relatively simple rules.

This series shows how the game can be designed fairly quickly using the C# programming language. The purpose is to demonstrate C# programming with an actual project that beginners can follow along with and code themselves. I’ve been wanting to code Conway’s for a long time and finally made myself do it. I have some other ideas for similar video series that I hope to develop after this one is complete.

Dropping some assumptions … #

Assumptions often mess us up, especially when we don’t recognize them. When I started creating videos, I assumed I needed a voiceover on them since all the other videos I was watching had one.

Then, for some reason, I assumed that I needed to record the voiceover at the same time as the video. That’s what it seemed like other people were doing and I didn’t want to just walk away from the challenge because it was too hard so that’s what I did.

Imagine trying to type and talk at the same time – you can’t really do it. Realize it or not – you’re pausing one as you do the other or you’re making a bunch of mistakes. Now imagine trying to program an application and trying to talk about what you’re doing and remembering to mention all the necessary points at the same time while knowing that the timer on the recorder is running. I did it for a number of videos but the result was a long, cumbersome editing process, an inconsistent sound to the videos and a real antipathy toward making videos.

I thought about doing a commentary-style track at one point, where the commentary is recorded after the video or writing the script out beforehand but didn’t trust that either would sound right.

Finally, I decided to try another approach I’d seen in some videos – no voiceover at all, just on-screen annotations and background music. I’d seen a couple videos like that and they were getting positive comments from people who were fed up with all the promotion-laden, over-produced videos on YouTube.

This actually works better for a number of reasons –

  • All the information is communicated, visually. There’s no danger that the viewer will miss or not understand something I said. I don’t have to worry about captioning the videos; the annotations do that on their own.
  • Viewers might often be working in environments where they can’t hear the video well. Now they don’t need to.
  • Moving on-screen titles help to keep viewers’ attention.
  • Editing goes a lot faster, especially once I have the steps worked out.

I’ve also found some good sources for free background music. I prefer the quiet guitar instrumentals that provide a nice, calm feeling to counter any panic inspired by some of the on-screen complexities I’m presenting.


Check Out the Videos #

So, if you’re interested in C# programming or would just like to see how one of these programs comes together, take a few minutes to check out the new videos and let me know what you think of this approach in the video comments. If you really like them, be sure to click Like and subscribe to the channel for upcoming content!

The Challenge #

Part I shows the process of getting the program started and actually creating a working version of Conway’s Game of Life. This program is a work in progress there’s still work to be done.

Speed it Up #

Part II demonstrates some debugging strategies in C# and shows how to track down the logic and algorithm issues that were slowing down the program in Part I.

Cleaning up the Code #

Part III demonstrates how to better organize the code according to principles of object orientation. This reduces redundancy and leads to cleaner, more maintanable code.

Letting the User Control the Grid #

Part IV shows how to enable the user to activate and deactivate cells in order to influence the simulation. The code refactoring in the last video makes this super easy. Then we let the user start with a blank grid so they can create their own patterns in the game.

Finishing the Application #

Part V adds a few final touches to the application, including a program menu and code cleanup. It also explains the difference between Debug and Release configurations and shows how to publish the app for distribution.

Powered by BetterDocs