I wanted to make sure I learnt from the course, so I coded TripleX again but I mostly rely on my memory.
I only refered to a part of video from the course once, and used just a bit of the source code from my first copy of TripleX.
I have proven to myself that I have indeed learnt how to write a basic C++ game.

This version of TripleX puts the player in the perspective of one who is doing a reCAPTCHA.
Here’s the source code for if tou want to play it for yourself:

``````#include <iostream>
#include <ctime>

void WelcomeMessage()
{
std::cout << "\n\n------- POV: You are doing a reCAPTCHA --------";
}

bool PlayGame(int Difficulty)
{
const int DigitA = rand() % Difficulty + Difficulty;
const int DigitB = rand() % Difficulty + Difficulty;
const int DigitC = rand() % Difficulty + Difficulty;

const int DigitSum = DigitA + DigitB + DigitC;
const int DigitProduct = DigitA * DigitB * DigitC;

std::cout << "\n\n\nEnter the correct 3 digit code (e.g. 1 2 3)\n Level " << Difficulty;
std::cout << "\n\n+ The sum of the digits is " << DigitSum;
std::cout << "\n+ The product of the digits is " << DigitProduct;
std::cout << "\n\nCODE: ";

int GuessA;
int GuessB;
int GuessC;

std::cin >> GuessA;
std::cin >> GuessB;
std::cin >> GuessC;

int GuessSum = GuessA + GuessB + GuessC;
int GuessProduct = GuessA * GuessB * GuessC;

if (GuessSum == DigitSum && GuessProduct == DigitProduct)
{
std::cout << "**CORRECT**";
return true;
}
else
{
std::cout << "**WRONG, TRY AGAIN**";
return false;
}
}

int main()
{
srand(time(NULL)); // Make random seed based on time of day

int LevelDifficulty = 1;
const int MaxDifficulty = 5;

WelcomeMessage();

while (LevelDifficulty <= MaxDifficulty)
{
bool bLevelComplete = PlayGame(LevelDifficulty);
std::cin.clear(); // Clears any errors