Follow along as I explain how to program a word guessing game in C++. This episode builds on a free 5-day email course that shows you step-by-step how to design and build WordGuess.

You can get the 5 daily emails by signing up at takeupcode.com/wordguess. Each email will explain how the program evolved and give you the exact source code for each step. You’ll get your first email right away and each additional email will arrive a day later.

I mention in the podcast that this is not like a book that breaks down a complete program into smaller pieces and explains how everything works. What I meant is this is not just like a book that breaks down a program into smaller pieces. It’s more than what a book can provide. The email course does explain things in small pieces. But it’s also a journey that we take together. You get to see how a method initially gets written and then how it changes over time.

You can also get the emails by sending a text message with the message:
wordless
to the short United States number 44222. You should get a reply right away asking for your email address. If you signup using this method, just help me have some patience because it’s not fully automated and I will need to add your email address manually to my email system so that you can start receiving the course.

The link above that goes to the Take Up Code website is fully automated and you’ll get your first email right after you confirm your subscription.

This email course came directly from one of my live weekend classes where we built this game from scratch in about 3 hours. I hope you get value and I also hope it will encourage you to start programming.

Listen to the full episode or read the full transcript below.

Transcript

There’s many ways to learn and we all have our favorite. The most effective way to truly master a skill is to make use of many different learning techniques. Listening to an audio podcast is great, but it’s just one technique. In this episode, we break away from the programming concepts that I’ve been explaining and focus on an actual project.

The game is called WordGuess and it’s simple really. I recently used this exact game in one of the Take Up Code live weekend C++ classes. It took 3 hours to go from a blank project to a playable game and that was including the time that I devoted to explaining concepts along the way.

You can get the 5 daily emails by signing up at takeupcode.com/wordguess. Each email will explain how the program evolved and give you the exact source code for each step. You’ll get your first email right away and each additional email will arrive a day later.

This is not like a book that breaks down a complete program into smaller pieces and explains how everything works. No. This is a journey that we take together. You get to see how a method initially gets written and then how it changes over time.

You can also get the emails by sending a text message with the message wordguess to the short United States number 44222. That’s wordguess, w o r d g u e s s to the number 44222. You should get a reply right away asking for your email address. This is a new system that I just setup for your convenience so if you take this approach, you’ll need to give me some time. It’s not fully automated yet. If you’re listening to this podcast at a later date, then I might have figured out how to get two separate automated systems to work together by then and you might get your first email right away. Until then, my phone messaging system can only send me an email with your email address. I then need to add your email address manually to my email system so that you can start receiving the course.

If you’re using an Android phone or are listening to this podcast from outside of the United States, then you might not be able to send text messages to special 5 digit numbers like this. I know that some Android phones block these numbers and other countries might have different short numbers. Or maybe you just don’t want to wait for my manual steps. You can always go to takeupcode.com/wordguess and subscribe there for the course.

Why go through all the trouble of signing up for the email course? Because then I can send you the source code so you can follow along. Believe me, there’s no way that I can describe how to write even a simple game like WordGuess using just audio. My voice would put you to sleep before we even made it past the empty main method. You don’t want to listen to me try to spell out line-by-line an actual program.

The email course already has a huge amount of explanation so I’m not going to just read emails to you on this podcast. I’m going to assume that if you know how to subscribe to a podcast, then you can read everything I wrote in the emails just fine. What I am going to do is fill in some of the gaps and provide more of the backstory. And hopefully encourage you to actually type the source code into your computer and build and run your own game.

Are you ready to get started? The first step is to signup for the WordGuess email course.

Now when I sit down to program something, it doesn’t matter what, I always start with an empty project. And if the project is unrelated to anything that I’ve already been working on, then I create a new workspace first. I like to program on my Mac and use Xcode most of the time. It works great even for C++. You can use whatever development environment and tools you want. This episode and the email course assumes you’ve already installed your development tools.

The first daily email that you get right away, or as soon as I can complete your signup, just contains a completely empty main method. Go ahead and create a new Main.cpp file and type this empty main method into your file. Then build and run your program.

Get in the habit of making small changes that you can build and run right away. Not only do you get to see the result right away but if there’s a problem, you’ll also have a much easier time figuring out what’s wrong because it should be something that you just did. You don’t want to be trying to figure out hundreds of problems all at once. A single grain of sand dropped on your head won’t hurt you. But a truckload of sand will cause some pain.

There’s not much to do with your game at this point except run it and watch it exit. But this will get you going and allow you to prove that your development environment is working. It might not seem like much but this simple empty program is sitting on a big first step. This is why I kept the first email so simple. You’ll have enough things to explore and figure out to just get the empty main method running.

Once you have it running, explore a bit. Go through your options and customize how your development environment looks and behaves. Some of the things I like to make sure are setup just the way I like them are:

◦ Colors. Pick colors that you’ll want to look at for long periods of time.

◦ Line numbers. I like to turn on line numbers for all my source files. For some development environments, this will give you a bit more room to use with your mouse pointer when selecting entire lines.

◦ Default project folders. Some environments want to put your projects in a hard to find location usually under the development environment executable itself. I like to create a folder right at the root of my drive called Projects.

◦ Tabs vs. spaces. Many languages use indenting to make your source code more readable. You can hit the tab button on your keyboard to indent a line. When you do indent a line, do you want to use real tab characters or simulate a tab by inserting spaces? I recommend using spaces instead of actual tabs. This is because if you ever open your files in a different editor or want to copy some code to email to a friend, then tabs can cause your code to look extra indented than you might expect. Spaces though always behave well. The main thing is to just pick one approach. The worst thing you can do is mix tabs and spaces together.

◦ And learn how your editor works. How do you indent multiple lines? How do you unindent them? How do you comment and uncomment multiple lines? How do you cut, copy, and paste text? How do you drag and drop text from one place to another.

◦ And my favorite is learning how to select text in block mode vs. line mode vs. column mode. Read your help or search for these text selection modes in your environment.

◦ Each environment is different, so take the time to get familiar with yours.

◦ And also take the time to browse through your project settings. Even if you don’t understand what it all means yet. Just explore.

Tomorrow, we’ll dive in for some more action.