Learn How To Build Your Own Game Of WordGuess In C++ With a 5-day Email Course.
Get an email every day that shows you how to program a game. Each email will add more and more to the game until you have a complete game that lets you guess words. You get to explore options along the way and experience the game as it develops.
This is just like what you would do if you were to start programming this yourself. Nobody goes from an empty page straight to the final design. We try things. We get something small working and then build on it.
Here’s what you’ll get now for signing up:
- Receive 5 daily emails that explain all the code step-by-step.
- Experiment and build each step to see your progress.
- Finish with a working game of WordGuess and ideas that will help you continue on your own.
- Each step described in detail starting with a blank page and ending with a fully functioning and simple game.
The final source code written in C++ is below. It’s a small and simple game consisting of just three methods. Even so, there’s a lot of explanation available in the email course. Enough that you’ll understand not just what’s here but why. And that will let you build on this and create a bigger and better game.
// Created by Wahid Tanner on 11/28/15.
using namespace std;
void playGame ();
string scrambleWord (string word);
cout << "Would you like to play WordGuess? y/n: ";
cin >> input;
if (input == 'y')
else if (input == 'n')
cout << "Goodbye!" << endl;
cout << "Please enter y or n: ";
void playGame ()
mt19937 rng; // rng stands for random number generator
// distribution in range [0, the number of items in the collection minus 1]
uniform_int_distribution<mt19937::result_type> distribution(0, wordCollection.size() - 1);
string wordToGuess = wordCollection[distribution(rng)];
string wordAfterScramble = scrambleWord(wordToGuess);
cout << "Guess this word: " << wordAfterScramble << endl;
cin >> input;
if (input == wordToGuess)
cout << "You won!" << endl;
cout << "Sorry, the word was: " << wordToGuess << endl;
string scrambleWord (string word)
uniform_int_distribution<mt19937::result_type> distribution(0, word.size() - 1);
for (int index = 0; index < word.size(); index++)
int firstIndex = distribution(rng);
int secondIndex = distribution(rng);
char temp = word[firstIndex];
word[firstIndex] = word[secondIndex];
word[secondIndex] = temp;
This is the full source code to the WordGuess game written in C++. This is what most books will show you when explaining how to program. They might break the code into smaller pieces and explain each piece. But you’re still getting just a single view into a finished product.
Now, I’ve been programming for a long time, and I still don’t sit down and go from an empty page right to the final product. And I don’t know anybody who does either. If you’re just beginning to learn how to code, then let me show you how to approach problems. This is how coding is done. There’s a system.
And you can learn how to start out with an empty page. What’s the first thing you should write? Where do you go from there? That’s what the 5-day email course shows you. It’s delivered over 5 days for a reason. So that you have time to process and understand each step.
If you just want to see the final source code, then there’s no need to subscribe. The email course is there to help if you want to understand the process. You’ll also get each step fully explained. Each line explained so you understand its purpose.
The emails you’ll receive in the 5-day course are:
- Day 1: Where do you begin?
- Day 2: How to display text and read user input.
- Day 3: Let’s turn this into a game.
- Day 4: Adding random behavior.
- Day 5 (of 5): Some final thoughts.