1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#include <stdio.h>
#include <string.h>
int main () {
bool in = false;
char userInput[]="o";
char name[30]="Blank";
char cont[2] = "i";
char quit[2] = "q";
char con[2] = "c";
char north[] = "north";
char south[] = "south";
char west[] = "west";
char east[] = "east";
char help[] = "help";
char b[] = "b";
char l[] = "l";
char d[] = "d";
char j[] = "j";
char p[] = "p";
char sd[] = "sd";
char patch[] = "patch";
char peek[] = "peek";
char crouch[] = "crouch";
char challenge[] = "challenge";
int i = 0;
printf("Please type in your name:");
scanf("%s", name);
printf("Hello, %s. Welcome to Adam's textspace game! Type c to continue, and q to quit.\n", name);
scanf("%s", &cont);
while(i==0){
printf("\nNow, the story begins...\n\nYou appear stranded in a desert, and have been dehydrated for two days. You must find water, shelter, and/or a way out of the desert. Press L to look around and HELP for help.\n\n");
scanf("%s", &userInput);
while ((strcmp(userInput, l) == 0) || (strcmp(userInput, help) == 0) || in == true){
in = true;
if (strcmp(userInput, help) == 0) printf("Type in NORTH for NORTH, SOUTH for SOUTH, EAST for EAST, and WEST for WEST.\n\n");
if (strcmp(userInput, l) == 0) printf("\nYou look around...\nTo the north is a small puddle of water, to the east is a lake that appears to have ridges appearing over the water, to the south is just a bunch of rocks, and to the west is a cave.\n\n");
if (strcmp(userInput, north) == 0) printf("\nYou go north towards the puddle of water, and take a look. It seems dirty, but still edible.\n Press D to drink, or SOUTH to go back south.");
if (strcmp(userInput, d) == 0) printf("\nYou drink the water and feel refreshed, but you start gagging. Press G to gag, or J to swallow.");
if (strcmp(userInput, j) == 0) printf("\nYou swallow, and you figure out that you gagged because of your dry throat. You feel good. Press B to go back south.");
if (strcmp(userInput, b) == 0) printf("\nYou move south, back to your previous location. To the west is a cave, to the east is a lake, now with no ridges, and to the south is still just a bunch of rocks.");
if (strcmp (userInput, south) == 0) printf("\nYou see rocks, lots of them. Type NORTH to go NORTH, and P to pick the rocks up.");
if (strcmp (userInput, north) == 0) printf("\nYou go back to your previous location and look back at the rocks. You see fire-ants crawling on them, and you feel thankful you didn't pick them up. To the west is a cave, and to the east is the lake.");
if (strcmp (userInput, east) == 0) printf("\nYou go east, towards the lake. Nothing dangerous is visible, and it seems safe to swim and drink from. Press SD to swim and drink from the lake, and BACK to go back to your previous location.");
if (strcmp (userInput, sd) == 0) printf("\nYou take a drink from the lake, then jump in. You have so much hydration that it's almost like you are NOT in a desert, but then, clouds start to form. You better find shelter! Type EAST to go to the cave, and SOUTH to go to the rocks.");
if (strcmp (userInput, south) == 0) printf("\nYou go to the rocks, and check for ants. None appear. Type P to pick up rocks, or BACK to go back to your previous location.");
if (strcmp (userInput, p) == 0) printf("\nYou pick up the rocks and go to the cave, and you see a shadow in the distance. It appears to be a hyena! You quickly hide in the cave, and make a life/death decision Type PATCH to close the cave with the rocks, or CHALLENGE to fight the hyena with the rocks.");
scanf("%s", &userInput);
}
if (strcmp (userInput, patch) == 0) printf("\nYou peek outside, and see a ranger with a gun. You instantly jump from the rocks and shout that you need help. The ranger brings you to the city, where you get a job and become a successful businessman.\n\nThe End.");
if (strcmp (userInput, challenge) == 0) printf("\nYou challenge the hyena, and see another one coming by. You throw the rock, but realize the hyena is a ranger. You are then under federal arrest for assault.\n\nThe End.");
if(strcmp(cont,quit) == 0){
i = 1;
}
else{
i = 0;
}
}
}
|