Skip to content

Instantly share code, notes, and snippets.

@bearh
Created October 27, 2013 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bearh/7176635 to your computer and use it in GitHub Desktop.
Save bearh/7176635 to your computer and use it in GitHub Desktop.
#0hgame lol This is my average 3am. Your goal is to waste an hour. Compiled binaries for OSX, Linux and FreeBSD are here: http://www.sendspace.com/file/pw9h9x I don't have a windows box to compile this on, so pull out Cygwin and compile it with GCC.
// Sorry for this horrible code.
// Believe me, I really can write better code. Seriously, I can. WHY ARE YOU DOUBTING ME.
// -bearh 01:26 am
//
// Compile and run with:
// gcc 3amrpg.c -o 3amrpg;./3amrpg
// on your nearest UNIX box.
#include <stdio.h>
#include <string.h>
int win(){
printf("You have successfully wasted an hour!\nYour winner!\n");
return 0;
}
int main(){
int action,time,location;
char user_input[8];
const char logo[] = ""
" _____ ____ ____ ____\n"
"|___ / __ _ _ __ ___ | _ \\| _ \\ / ___|\n"
" |_ \\ / _` | '_ ` _ \\| |_) | |_) | | _\n"
" ___) | (_| | | | | | | _ <| __/| |_| |\n"
"|____/ \\__,_|_| |_| |_|_| \\_\\_| \\____|\n"
"\nIt is 3am. Your room is dark. You are hungry and bored.\n"
"What do you do?\n"
"You look around of course!\n";
const char room[] = ""
"You are at your desk.\n"
"Right in front of you is your laptop, a clock, two books and two"
"calculators\n"
"You can see a door which leads to a hallway\n"
"[0] Do nothing\n"
"[1] Browse the net\n"
"[2] Mess with the calculators\n"
"[3] Stare at clock\n"
"[4] Attempt to read book\n"
"[5] Go to hallway.";
const char hallway_up[] = ""
"You are in a hallway. It smells odd.\n"
"[0] Go back\n"
"[1] Keep walking";
const char hallway_down[] = ""
"This hallway smells better\n"
"[0] Go back?\n"
"[1] Go enter the kitchen\n"
"[2] Go to the server room";
const char kitchen[] = ""
"you enter the kitchen.\n"
"[0] Leave\n"
"[1] Make food";
const char server_room[] = ""
"[0] Leave\n"
"[1] Mess around with the server";
location = 0;
printf("%s\n",logo);
for(time = 0;time < 60;time++){
printf("Time 3:%i am\n",time);
switch(location){
case 0:
printf("%s\n",room);
break;
case 1:
printf("%s\n",hallway_up);
break;
case 2:
printf("%s\n",hallway_down);
break;
case 3:
printf("%s\n",kitchen);
break;
case 4:
printf("%s\n",server_room);
break;
}
fgets(user_input,sizeof(user_input),stdin);
action = atoi(user_input);
switch(location){
case 0:
switch(action){
case 0:
printf("You did nothing!\n");
break;
case 1:
printf("You browsed the net!\n");
break;
case 2:
printf("You typed some random things on the calculators!\n");
break;
case 3:
printf("You looked at the clock until it progressed a min\n");
break;
case 4:
printf("You attempt to read a book. You can't be bothered to think.\n");
break;
case 5:
printf("You leave the codecave!\n");
location = 1;
break;
}
break;
case 1:
switch(action){
case 0:
printf("You go back to the cave\n");
location = 0;
break;
case 1:
printf("You keep and walking and end up going down some stairs.");
location = 2;
break;
}
break;
case 2:
switch(action){
case 0:
printf("You go back up the stairs\n");
location = 1;
break;
case 1:
printf("You go enter the kitchen\n");
location = 3;
break;
case 2:
printf("You go enter the server room!\n");
location = 4;
break;
}
break;
case 3:
switch(action){
case 0:
printf("You left the kitchen\n");
location = 2;
break;
case 1:
printf("You look for food. There is nothing here.\n");
break;
}
break;
case 4:
switch(action){
case 0:
printf("You left the server room\n");
location = 2;
break;
case 1:
printf("You mess around with the server\n");
break;
}
break;
}
}
win();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment