lol I got the exact same random number as Gavin did:
That’s crazy!!! You created and played the game at the same time and day he made it a year ago!!! The chance of that happening is so low! Congrats man!
1 Like
Ah, so those results wasn’t based on the time since we aren’t using srand(time(NULL)) at this point yet. So this should most likely appear the same for everyone.
2 Likes
Yea
1 Like
Yep I got the exact numbers too
2 Likes
Same here. Maybe that’s the value it prints when you don’t specify the range. It happened twice in a row for me
lol same
here my progress
#include <iostream>
void PrintIntroduction(int Difficulty)
{
std::cout << std::endl << std::endl;
std::cout << "................................................................................\n";
std::cout << "...................................=:......~,...................................\n";
std::cout << "...................................~:...,=.::...................................\n";
std::cout << "...........................+:+.........?7=.~....~:...~,=........................\n";
std::cout << ".....................==....~=:~.....:..=~+.~....+...I,~.........................\n";
std::cout << ".....................:,=....?.+........:,.=?...=,..=~?~,........................\n";
std::cout << ".......................?.....:,:+...~..+~..........,.?I+........................\n";
std::cout << "........................?~....,I~...+=.+,.~...:....=:~.=.+....=+................\n";
std::cout << ".................?........:....:,:+=:=.~,I,..~..:.:=+.~:....=+~?................\n";
std::cout << ".................:,~,......=?..+~??.I,.=:==..I.+:7=.~,....++?...................\n";
std::cout << "...........~:~?...=,.~......:=..?~?.?,.+:~,.=~~=,~.,=...+~+,?...................\n";
std::cout << "..........+??:+~~.:+:7:~.7I..:,+?,=:+,?7~.==,++II,:...,.~.......................\n";
std::cout << "............~7=+I..~+:~77:=...,,~:~=+==:=?+~=+,?+~:=::~==?......................\n";
std::cout << ".................===~.==,:7==:+:+:.:~~~:,,~~:,I+I,:=+~?.........................\n";
std::cout << "...........?+........I+:.:,~~~I+?+:..:==~?,~++I+:,~?............I:..:...........\n";
std::cout << "...........+===.:~.....~I=~~,,==+7=I=.,=~++I=,=,~?~........:+::=+I+=+:=.........\n";
std::cout << "...................+:,:,=?=,,=+~..I,.:~.,++I?,.::~???,~,,==+~,,:.:=,:~=.........\n";
std::cout << "...............:+,~,=?=,=:??,=~=+,I:+:+,,.I+,=,,:+::=I.~==+:~~..................\n";
std::cout << "........................?:==~:~:=.~+?I~:::,..,+?,~7:?...........................\n";
std::cout << "..........I=I.?I?~+=I~:=,~:==:???..+~,:,..=~~.~:I?~,~...........................\n";
std::cout << ".........?+.~~:7=.......+=+~~?~?.~,:~,=..:.::~.=~.,.~I:++=~.....................\n";
std::cout << "...................=~:=+=+:~I~:++~+??,?,.~:::?~?~:++,7=+,:~:..~=.:?:++,.........\n";
std::cout << "..............I,,,~:~=?....=..~~7.~?=I~~~?~:.~??:.=~.?+:..?,:+.....=+:~=........\n";
std::cout << "........~::.=+...........~:+,?7:~+=+~+=+?.:,::++~==.~:....=:~?,,~+..............\n";
std::cout << "......................+,=+~:++?,:~.+::?=.=+::,.?=,+,:=~,?.......:=+.............\n";
std::cout << "....................:,?,=...====.,=~=7I=:,??.~,~~,.+,:..=.,~....................\n";
std::cout << ".................,,..I=.....~,.,=~~,,:,~,,,=I.+,+.~I..+:...+,.+.................\n";
std::cout << ".............I~..~.:.......:~=.=~:~~:,=+,=,?~,~....I:...,+...++:.=..............\n";
std::cout << ".............=,=.=........:.~~=.,?:.:~.+I..==+:+:=...:~...+.:...:+..............\n";
std::cout << ".............,?:........~..:,=,~=++.~,~==..~:~=:=+.:..:.....~=?.................\n";
std::cout << ".......................:=..:..,:,:..:.+:+...=,,~:..~:.........+.................\n";
std::cout << "......................~7,:....:~~+..~++..+..+~,.I,,..,..........................\n";
std::cout << ".......................:~:,..?,=,?.:+.:.=,..+~~.~,=,~=+.........................\n";
std::cout << "......................,,....++?,~..:,.~..=...~=.,+~,:=,:~.......................\n";
std::cout << ".......................:...?+~=....:..=..:....=:.=.,,=..........................\n";
std::cout << ".............................+=....:....I~.....=~=..............................\n";
std::cout << "...................................,.....?......................................\n";
std::cout << "................................................................................\n";
std::cout << "................................................................................\n";
std::cout << "\n";
std::cout << "\n\nEn uno de los ultimos laboratorios en el piso " << Difficulty;
std::cout << " aun queda esperanza\n\nLos virus han extinguido casi por completo la especie humana\n\n";
}
bool PlayGame(int Difficulty)
{
PrintIntroduction(Difficulty);
std::cout << "Eres una cientifica descifrando un virus... \n";
std::cout << "Necesitas introducir un codigo para continuar al siguiente..\n";
// Declare 3 number code
const int CodeA = rand();
const int CodeB = rand();
const int CodeC = rand();
const int CodeSum = CodeA + CodeB + CodeC;
const int CodeMul = CodeA * CodeB * CodeC;
// Print sum and product to the terminal
std::cout << "+ Hay tres numeros en el codigo";
std::cout << "\n+ Los codigos suman: " << CodeSum;
std::cout << "\n+ Los codigos multiplicados dan: " << CodeMul << std::endl;
// Store player guess
int GuessA, GuessB, GuessC;
std::cin >> GuessA >> GuessB >> GuessC;
int GuessSum = GuessA + GuessB + GuessC;
int GuessMul = GuessA * GuessB * GuessC;
// Check if player guess is correct
if (GuessSum == CodeSum && GuessMul == CodeMul)
{
std::cout <<"\nGanaste, pasas a descifrar el siguiente virus";
return true;
}
else
{
std::cout <<"\nPerdiste, vuelve a intentarlo";
return false;
}
}
int main()
{
int LevelDifficulty = 1;
const int MaxLevel = 7;
while (LevelDifficulty <= MaxLevel)
{
bool bLevelComplete = PlayGame(LevelDifficulty);
std::cin.clear(); // Clears any errors
std::cin.ignore(); // Discards the buffer
if (bLevelComplete)
{
++LevelDifficulty;
}
}
std::cout << "\n\nFelicidades, encontraste todas las curas!!!\n";
return 0;
}
1 Like