Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created April 26, 2023 18:11
Show Gist options
  • Save codecademydev/78ad03b7733da89bc1e176cf46e07b51 to your computer and use it in GitHub Desktop.
Save codecademydev/78ad03b7733da89bc1e176cf46e07b51 to your computer and use it in GitHub Desktop.
Codecademy export
#include <iostream>
#include <string>
int gleam(){
int input;
std::cout<<"What now? Do you:\n"<<"1) Gleam dat cube\n"<<"2) Destroy it for fear of it falling into the hands of your nemesysadmin\n";
std::cin>>input;
if (input==1){
std::cout<<"It glows with power beyond that of your processor! You fuse with the lolcats! Your base are belong to the interwebs!\n"<<"======================"<<"===You are code now==="<<"======================";
return 0;
}
else if (input==2){
std::cout<<"You attempt to destroy the Cube, but the Cube awakens and ejects you from the motherboard with a primal screech of binary!\n"<<"==========================\n"<<"===You have been sliced===\n"<<"==========================\n";
return 0;
}
else{
std::cout<<"While you were fumbling for the right key on your numpad, your dreaded nemesysadmin caught up to you!\n"<<"==========================\n"<<"===You have been sliced===\n"<<"==========================\n";
return 0;
}
}
int slice(){ std::cout<<"==========================\n"<<"===You have been sliced===\n"<<"==========================\n";
return 0;
}
int victory(){
std::cout<<"==========================\n"<<"===You are victorious!!!===\n"<<"==========================\n";
return 0;
}
void gleam_dat_cube(){
std::cout<<" ________.__ \n"<<" / _____/| | ____ _____ _____ \n"<<"/ \\ ___| | _/ __ \\\\__ \\ / \\ \n"<<"\\ \\_\\ \\ |_\\ ___/ / __ \\| Y Y \\ \n"<<" \\______ /____/\\___ >____ /__|_| / \n"<<" \\/ \\/ \\/ \\/ \n"<<"________ __ \n"<<"\\______ \\ _____ _/ |_ \n"<<" | | \\\\__ \\\\ __\\ \n"<<" | ` \\/ __ \\| | \n"<<"/_______ (____ /__| \n"<<" \\/ \\/ \n"<<"_________ ___. \n"<<"\\_ ___ \\ __ _\\_ |__ ____ \n"<<"/ \\ \\/| | \\ __ \\_/ __ \\ \n"<<"\\ \\___| | / \\_\\ \\ ___/ \n"<<" \\______ /____/|___ /\\___ >\n"<<" \\/ \\/ \\/ \n";
}
int main (){
std::string username;
std::string vpn;
std::string stuff;
std::string affirmatron;
//Let's track how many mistakes are made
int mistakes=0;
//And choices made
int choice1;
int choice2;
std::cout<<"Now before you enter the game, please state your leet haxxor username!\n";
std::cin>>username;
std::cout<<"A flash of subtronic gammas blasts through your cortex!\n You have been enhanced and are now known as the ultraleet haxxor, "<<username<<"69@aol.com! As you contemplate this new level of existence, one word echoes inside the cavernous depths of your subroutines...\n A word which you cannot help but enter into the terminal now before you... \n a word that is synonymous with ultimate destiny...";
std::cin>>vpn;
std::cout<<"Yes, *"<<vpn<<"*, that was it. Will it become significant in a later moment of great peril? Foreshadowing aside, it's time to enter the interwebs... it's time to...\n";
std::cin.ignore();
std::getline (std::cin,stuff);
if (stuff=="gleam dat cube"){
std::cout<<"You betcha it's time to \n";
}
else{
std::cout<<"What? No, it's time to\n";
}
gleam_dat_cube();
//That was one hell of an intro!
//The story resumes
std::cout<<"Do you jack in? (y/n)\n";
for(int i=5;i>0;i--){
std::cin>>affirmatron;
if(affirmatron=="y"){
i=0;
}
else{
std::cout<<"Please... the lolcats need your help!\n";
++mistakes;
}
}
if (mistakes==0){
std::cout<<"You jack in, without a moment's hesitation! Hugh Jackman would be proud of you.\n";
}
else{
std::cout<<"YOUR RELUCTANCE WILL BE DATARIZED, the terminal intones in block capitals, and before you know it you are jacked into the mainframe!\n";
}
std::cout<<"It's a stormy nanocycle and no mistake. Flash games have ceased to function. Functions have been deprecated. Deprecating remarks are flashing red.\n";
// maybe add some more story here
std::cout<<"Suddenly, another haxxor appears, surfing the gigaflops with their gnarly visors on backwards!\n It's PneumaticPanda2000, your arch rival!\n'Prepare to get sliced, "<<username<<"69@aol.com! Your fancy new moniker can't save you now!'\n Do you:\n"<<"1) Escape through a backdoor\n"<<"2) Face/off with your nemesysadmin \n"<<"3) Attempt to show them the error 404 of their ways, and convince them to join your side at last\n";
//First major branch of story! Option 3 should be affected by how many mistakes have been made
std::cin.ignore();
std::cin>>choice1;
if(choice1==1){
std::cout<<"You perform a triple axel double backslash and Donkey the Kong out of that backdoor!\n Now you are in a forbidden area filled with fragmented floppy disks. You hear the soft burble of a lost message board nearby.\n Do you:\n 1) Search the floppy disks in hope of finding a compressed .zip of the Cube\n 2) Post a message about the Cube on the bulletin board\n";
}
else if(choice1==2) {
std::cout<<"'Not if I slice you first!' you retort.\n The cyberbattle begins! Do you:\n"<<"1) Delete the adversary's binaries ruthlessly with a double-bladed dual booter\n"<<"2) Remain on the defensive using the power of "<<vpn<<"VPN, the best option for internet privacy, all the whie tricking your rival into bluescreening themselves out of the system\n";
}
else if(choice1==3){
if(mistakes>2){
std::cout<<"'Negatronic! Who are you to lecture me when your segfaults are in excess of mine!'\n"<<"You are beset by beams of code from PneumaticPanda2000's hexagloves! Do you:\n"<<"1) Try to absorb the blast with the power of "<<vpn<<"VPN, providing you with more than 5,000 servers in 60 countries with which to hide your internet activity\n"<<"2) Try to counterattack with a reverse Trojan parenthetical move\n";
}
else{
std::cout<<"'You have convinced me! Together we can join forces against the Ultra Kodex and commit that git to nanojail for crimes against webmanity!' your former nemesysadmin replies, before exploding into a thousand 👍 symbols.\n"<<"With the power of "<<vpn<<"VPN, the finest in internet protection and privacy, you launch a full scale cyberassault on the 8-bit citadel and save the day!\n";
victory();
}
}
std::cin>>choice2;
if(choice2==1&&choice1==1){
//floppy disk search
std::cout<<"You scan your surroundings, and there it is, the legendary Cube in all its totally tubular glory.\n";
gleam();
}
else if(choice2==2&&choice1==1){
//bulletin board chat
std::cout<<"You wait ages for a reply to your bulletin board post...\n PneumaticPanda2000 finds your hiding place and boots you out with!";
}
else if(choice2==1&&choice1==2){
//Battle tactic 1 offensive
std::cout<<"You charge up to 99% and then utterly destructoidify your adversary with the power of the inverse cube law.\n 'Curse you, "<<username<<"69@aol.com! If only I'd used "<<vpn<<"VPN to protect my internet activity!' they lament, before you summarily eject them from the motherboard.\n";
victory();
}
else if(choice2==2&&choice1==2){
//Battle tactic 2 defensive
if (mistakes>3){
std::cout<<"Oh no! You made too many errors and your computer freezes up!\n";
slice();
}
else{
std::cout<<"PneumaticPanda2000's aggressive moves are no match for your VPN, and their own folly sends them crashing head over teakettle through heptaflops of temp data!\n";
victory();
}
}
else if(choice2==1&&choice1==3){
//Use a VPN
std::cout<<"PneumaticPanda2000's aggressive moves are no match for your VPN, and their own folly sends them crashing head over teakettle through heptaflops of temp data!\n";
victory();
}
else if(choice2==2&&choice1==3){
//Counterstrike Reverse Trojan parenthetical
}
}
//Goals:
//A beginning and three possible endings
//Three or more branch points with at least two choices
//Some branches may reconnect
//Use a for loop for
//*validating user input
//*give user multiple chances 'Are you sure?'
//*continue adventure until the user makes a specific choice
// Then refactor program with functions.
// Add ASCII art
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment