diff --git a/Game/Project proposal.docx b/Game/Project proposal.docx new file mode 100644 index 0000000..f05bc84 Binary files /dev/null and b/Game/Project proposal.docx differ diff --git a/Game/README.txt b/Game/README.txt new file mode 100644 index 0000000..a0ce2db --- /dev/null +++ b/Game/README.txt @@ -0,0 +1,60 @@ +# Final Project + +It’s a text adventure game. You play as a rap god trying to collect his rap lyric notes. You win when you rap by yourself in a shack. +I picked a text adventure game to do because it seemed accomplishable and I like playing games. + +## Compliation +gcc game.c + +## How to play +Type in commands at the >> prompt. Available commands are: + - goto [location] will print out a statement when you move to the room then print out the new room summary + - take [item] will move the item into your inventory + - look - print a look summary + - read note - will display collected notes + - yell - will make you yell. (doesn't do anything unless you're in the yard) + - cook (only in kitchen) + - QUIT - Quits game + - help - prints this + +## Differences from proposal + - Player has more variables, like inventory size, has_poo, has_backpack, notes_read. + - never implemented enumerator, just used strings instead + - Room summaries can change, though none of them really do as I put in a separate "room" with a different functionality. Room pointers can point to different rooms too, so you can create multiple rooms with the same room name. + - Commands are each their own individual functions and could be called from the get_args function but I didn't have time to really change this so they're all in main. + - Look in bag not implemented, it just prints inventory all the time as it got cumbersome to try to just look in bag + - there is no Open command as it would have made it unnecessarily complicated + - Go is goto + - Help would be easy to put in, though I feel it was redundant as the game is pretty easy. + - put would have also made the game too complicated. + - there are new room-specific commands like cook and rap that help you to win the game. + +## How to win +Use these commands in this order: + - goto bedroom + - take backpack + - take note + - goto yard + - take note + - yell + - goto park + - take note + - take dog poo + - goto yard + - goto kitchen + - cook dog poo + - take note + - take rusty key + - goto yard + - goto shack + - take note + - read note + - rap + +Use these commands to lose the game: + - goto bedroom + - take backpack + - goto yard + - goto park + - goto anywhere +alternatively: QUIT or goto QUIT works well. \ No newline at end of file diff --git a/Game/a.out b/Game/a.out new file mode 100755 index 0000000..6b19bc0 Binary files /dev/null and b/Game/a.out differ diff --git a/Game/func.c b/Game/func.c new file mode 100644 index 0000000..dc6599d --- /dev/null +++ b/Game/func.c @@ -0,0 +1,266 @@ +#include +#include +#include +#include "func.h" + + + +void get_args(char* arg1 , char * arg2, char* command) // The input sanitizer, it will return the first arg as the first word, the second as all words after +{ + int i = 0, j = 0; + for(;i <= (int) strlen(command); i++) //Iterate through commands + { + arg1[i] = command[i]; //Copy first word to char + if (command[i] == '\n' || command[i] == ' ')//When you reach a space or newline, replace with end char + { + arg1[i] = '\0'; + i++; + break; + } + } + for(; command[i] != '\0'; j++, i++) // repeat for second arg + { + arg2[j] = command[i]; + if (command[i] == '\n') + { + arg2[j] = '\0'; + break; + } + } +} + +void print_room_summary(character *playerPtr) // This prints the "HUD" for the player: inventory, items in the room +{ + int saw = 0, is_last = 0; + printf("|%s|\n", playerPtr->current_room->room_name); + printf("%s\n\n", playerPtr->current_room->description); + + //PRINT ROOM'S ITEMS + printf("I see"); + for (int i = 0; i < playerPtr->current_room->items_size; i++) + { + is_last = 1; + for (int j = i+1; j < playerPtr->current_room->items_size; j++) + { + if (playerPtr->current_room->items[j] != NULL) is_last = 0; + } + if (playerPtr->current_room->items[i] == NULL) + ; + else if (is_last && saw == 1) + { + printf(" and a %s", playerPtr->current_room->items[i]); + } + else + { + printf(" a %s", playerPtr->current_room->items[i]); + if (playerPtr->current_room->items[i+1] != NULL) printf(","); + saw = 1; + } + + } + if (!saw) printf(" nothing here"); + printf(".\n"); + + //PRINT INVENTORY + if (!playerPtr->has_backpack) + { + printf("\n\n"); + return; + } + printf("I have: "); + for (int i = 0;i < playerPtr->inventory_size; i++) + { + if (playerPtr->inventory[i] == NULL) continue; + printf("|%s| ", playerPtr->inventory[i]); + } + printf("\n\n"); +} +void take(character * playerPtr, char * item, room * roomPtr, int room_items_size) // Transfers an item in the room to inventory. Didn't know where else to put the backpack interaction +{ + int slot = 0; + while (playerPtr->inventory[slot] != NULL) + { + slot++; //find a free slot. This might produce a segfault somehow but I have not been running into errors. + } + if (slot+1 == playerPtr->inventory_size) //no free slots + { + printf("\033[2J"); + printf("I have no room left in my bag. Might as well just sit here."); + return; + } + for (int i = 0; i < room_items_size; i++) + { + if (playerPtr->current_room->items[i] != NULL) //if the item in the room exists. Just to prevent segfaults with strcmp + { + if(strcmp(playerPtr->current_room->items[i], item) == 0) //if the item we're looking for is in the room + { + if (strcmp(item, "backpack") == 0) //hardcoded backpack interactions + { + playerPtr->has_backpack = 1; //do NOT add to inventory! + playerPtr->current_room->items[i] = NULL; //delete from room + printf("\033[2J"); + printf("I can hold things now.\nThere's a note still here! I can [read note].\n\n\n\n"); + printf("Press enter to continue.\n"); + + return; + } + if (playerPtr->has_backpack == 0) + { + printf("I try to pick up the %s, but I hopelessly fumble and drop it.", item); + return; + } + playerPtr->inventory[slot] = playerPtr->current_room->items[i]; //add a copy of the item to inventory + roomPtr->items[i] = NULL; //delete + printf("%s\n", playerPtr->current_room->items[i]); //reprint summary + printf("\033[2J"); + print_room_summary(playerPtr); + return; + } + } + } + printf("I can't find a %s here.", item); +} +void moveto(character*playerPtr, char *droom, room * rooms[]) //Moves character to a connected room. Converts strings to rooms first. Also where I put the interactions with rooms +{ + int connected = 0, found = 0; + room *to_room; + for (int i = 0;;i++) + { + if (strcmp(rooms[i]->room_name, "END") == 0) //end of rooms list + break; + if (strcmp(droom, rooms[i]->room_name) == 0) //we found a room + { + to_room = rooms[i]; //convert the droom string to a room pointer + found = 1; + } + } + for (int i = 0;;i++) + { + if (found && strcmp(playerPtr->current_room->connected_rooms[i], to_room->room_name) == 0) //check for room in connected_room + { + connected = 1; + break; + } + if (strcmp(playerPtr->current_room->connected_rooms[i], "END") == 0) //If we've reached end of list + { + + if (i-1 == 0) //If there's only one connected room + { + moveto(playerPtr, playerPtr->current_room->connected_rooms[0], rooms);//move there instead + return; //cancel original moveto + } + break; + } + } + + if (!found) //no rooms found + { + if (strlen(droom) != 0) //if they wanted to move somewhere + printf("I don't know where that is."); + + return; + } + + if (strcmp(playerPtr->current_room->room_name,droom) == 0) //already in room + { + printf("You're already here."); + return; + } + if (!connected) //room not connected + { + printf("I can't get to the %s from here.", to_room->room_name); + return; + } + if (strcmp(playerPtr->current_room->room_name, "bedroom") == 0 && playerPtr->has_backpack == 0) //hard coded + { + printf("I should [take] my backpack before I go."); + return; + } + if (strcmp(to_room->room_name, "kitchen") == 0) //hard coded + { + for (int i = 0; i < playerPtr->inventory_size; i++) + { + if (playerPtr->inventory[i] != NULL && strcmp(playerPtr->inventory[i], "dog poo") == 0) + playerPtr->has_poo = 1; + } + if (!playerPtr->has_poo) + { + printf("I don't feel like going to the kitchen without something to cook."); + return; + } + } + if (strcmp(to_room->room_name, "shack") == 0) //hard coded again + { + int has_rkey = 0; + for (int i = 0; i < playerPtr->inventory_size; i++) + { + if (playerPtr->inventory[i] != NULL && strcmp(playerPtr->inventory[i], "rusty key") == 0) + has_rkey = 1; + } + if (!has_rkey) + { + printf("I can't get into the shack without a key."); + return; + } + } + playerPtr->current_room = to_room; + printf("\033[2J"); + printf("%s\n\n\n\n", playerPtr->current_room->entrance_msg); + printf("Press enter to continue.\n"); +} + +void look(character* playerPtr) // Prints look statement. This function was not needed honestly +{ + printf("\033[2J"); + printf("%s\n\n\n\n", playerPtr->current_room->look_msg); + printf("Press enter to continue.\n"); +} +void note(character* playerPtr) // The note system. I could've just iterated but I already had the switch statements set up +{ + for (int i = 0; i < playerPtr->inventory_size; i++) + { + if (playerPtr->inventory[i] != NULL && strcmp(playerPtr->inventory[i], "note") == 0) + { + playerPtr->notes_read++; + playerPtr->inventory[i] = NULL; + } + } + + if (playerPtr->notes_read == 0) + { + printf("Read what?"); + return; + } + + printf("\033[2J"); + int note_reader = 0; + do + { + switch (note_reader) + { + case 1: + + printf(" MAP: |"); printf(" MY SICK RAP:\n"); + break; + case 2: + printf("BEDROOM -> YARD<- |"); printf("but for me to rap like a computer must be in my genes\n"); + break; + case 3: + printf(" | / | \\ |"); printf("I got a laptop in my back pocket\n"); + printf("KITCHEN<- PARK ->SHACK |"); printf("my pen'll go off when I half cock it\n"); + break; + case 4: + printf(" | |"); printf("got a fat knot from that rap profit\n"); + break; + case 5: + printf(" | |"); printf("made a living and a killing off it\n"); + break; + case 6: + printf(" RAP HERE |"); printf(" --\"Gap Rod\""); + + break; + } + note_reader++; + } while (note_reader <= playerPtr->notes_read); + printf("\n\n\nPress enter to continue\n"); +} diff --git a/Game/func.h b/Game/func.h new file mode 100644 index 0000000..0052f48 --- /dev/null +++ b/Game/func.h @@ -0,0 +1,32 @@ +#ifndef FUNC_H +#define FUNC_H + +typedef struct { + char * room_name; //room's name + char * connected_rooms[10]; //names of connected rooms. Note that this is not pointers as I didn't know how to make an array of room pointers while in a room + char * items[10]; //names of items. There is no item struct, though that would have been a good idea. + char entrance_msg[200]; + char description[200]; + char look_msg[200]; + int items_size; //size of items. Can't pass array size to function, so I have this. +} room; + +typedef struct { + room * current_room; + int has_backpack; + int inventory_size; + char * inventory[6]; + int notes_read; + int has_poo; + +} character; + +//function prototypes! +void print_room_summary(character *playerPtr); +void get_args(char*, char*, char*); +void take(character*,char*,room*,int); +void moveto(character*, char*, room**); +void look(character*); +void note(character*); + +#endif diff --git a/Game/game.c b/Game/game.c new file mode 100644 index 0000000..5fecf10 --- /dev/null +++ b/Game/game.c @@ -0,0 +1,195 @@ +#include "func.c" + +int main() +{ + /* SET ROOMS ---------------This provides the strings for all the rooms that are coded.--------*/ + /* SET START --------------------------------*/ + room start = {"start", {"bedroom","QUIT", "END"},{},{},{},{},0}; + room * startPtr = &start; + strcpy(start.description , "Rapper Quest.\n[goto] the bedroom to start.\ntype QUIT to exit at any time."); + strcpy(start.look_msg, "Get out of here already"); + /* SET START --------------------------------*/ + + /* SET BEDROOM --------------------------------*/ + room bedroom = {"bedroom", {"yard", "kitchen", "QUIT", "END"}, {"note", "homework assignment", "backpack"},{},{},{},3}; + room * bedroomPtr = &bedroom; + strcpy(bedroom.entrance_msg, "I walk to my bedroom and sit on the bed.\nI should [look] around."); + strcpy(bedroom.description, "My bedroom. Nothing special. My bed is still undone."); + strcpy(bedroom.look_msg, "Someone tore up all my notes!\nI should go look for them.\nI should [take] my stuff first."); + /* SET BEDROOM --------------------------------*/ + /*SET YARD----------------------------------*/ + room yard = {"yard", {"bedroom", "park", "kitchen", "shack", "QUIT", "END"},{"note","garden gnome"},{},{},{},2}; + room * yardPtr = &yard; + strcpy(yard.entrance_msg, "I walk outside."); + strcpy(yard.description, "I haven't mowed the lawn in a while. "); + strcpy(yard.look_msg, "There's nobody here.\nWait, I think I see someone in the park.\nI could try to [yell] or go see who it is."); + /*SET YARD----------------------------------*/ + + /*SET PARK - there are two versions of park, one with the man and one scared away. Going to park will make you lose.*/ + room park = {"park", {"QUIT", "END"}, {},{},{},{},1}; + strcpy(park.entrance_msg, "I walk to the park. I try to say hello to the man here."); + strcpy(park.description, "There's a man here. Frightened,\nhe pulls out a knife and stabs me."); + strcpy(park.look_msg, "Oh. He's still stabbing me.\nI'm gonna die pretty soon."); + + room park_ran = {"park", {"yard", "treehouse", "QUIT", "END"}, {"note", "dog poo"}, {},{},{}, 2}; + strcpy(park_ran.entrance_msg, "I walk to the park."); + strcpy(park_ran.description, "The park looks nice today.\nThe birds are chirping,\nsun is shining."); + strcpy(park_ran.look_msg, "Who didn't clean up?"); + room * parkPtr = &park; + /*SET PARK-------------------------------------------------*/ + + /*SET KITCHEN -- dog poo is required to go to the kitchen. */ + room kitchen = {"kitchen", {"bedroom", "yard", "QUIT", "END"}, {NULL, NULL }, {},{},{}, 2}; + strcpy(kitchen.entrance_msg, "I go to my kitchen."); + strcpy(kitchen.description, "It's so gross in here.\nI should learn to cook sometime soon."); + strcpy(kitchen.look_msg, "I can probably use the oven to [cook] something.\nIt smells like dog poo in here."); + room * kitchenPtr = &kitchen; + /*SET KITCHEN -- dog poo is required to go to the kitchen. */ + + /*SET SHACK - end of the game once you "rap" in the shack with all notes. */ + room shack = {"shack", {"yard", "QUIT", "END"}, {"note"}, {}, {}, {}, 2}; + strcpy(shack.entrance_msg, "I unlock the shack.\nI have never been in here before, actually.\nKinda sad."); + strcpy(shack.description, "I can feel the shack's magic energies.\nEither that, or the fumes are getting me high."); + strcpy(shack.look_msg, "Hmm..."); + room * shackPtr = &shack; + + /*SET QUIT- going to this room is equivalent to losing the game.*/ + room quit = {"QUIT", {},{"participation trophy", "cookie", "cake"},{},{},{},3}; + strcpy(quit.entrance_msg, "Game over!"); + strcpy(quit.description, "This is the room just for losers. Unless you won. Then..good for you."); + strcpy(quit.look_msg, "Stop looking around. Just leave."); + room *quitPtr = &quit; + /*SET QUIT*/ + + /* room END for the end of the room list just so I don't have to pass a room list size every time */ + room end = {"END",{},{},{},{},{},0}; + room * endPtr = &end; + + room * roomPtr_list[8] = {startPtr, bedroomPtr, yardPtr, parkPtr, kitchenPtr, shackPtr, quitPtr, endPtr}; + /* SET ROOMS -----------------------------------------------------------------*/ + + /* SET PLAYER - mainly all interaction and data modification is through the player/player pointer*/ + character player = {NULL,0,6,{"note",NULL,NULL,NULL,NULL,NULL},0,0}; + character * playerPtr = &player; + player.current_room = startPtr; //put him/her in start + /* SET PLAYER */ + + /* SETUP INTERFACE */ + printf("\033[2J"); + print_room_summary(playerPtr); + printf("\n"); //just so you don't have to press enter twice to start the game. + + //GAME LOOP ------------------------------------------------------------------------- + int running = 1; + while (running) + { + + /* GET INPUT */ + int n = 3; + char * command = malloc(n*sizeof(char)); + printf(">> "); + fgets(command, n, stdin); //Take command + size_t last = strlen(command); + while (command[last-1] != '\n') //stolen from powerpoint on dynamic memory. Don't really understand how it works. + { + n *= 2; + command = realloc(command, n); + fgets(command+last, n/2, stdin); + last = strlen(command); + } + char *arg1 = (char*) malloc(strlen(command)*sizeof(char)); //Dynamically allocate args to size of command + char *arg2 = (char*) malloc(strlen(command)*sizeof(char)); + + if (strlen(command)) + get_args(arg1, arg2, command); + free(command); + /* GET INPUT*/ + + printf("\033[2J"); + print_room_summary(playerPtr); + + /* EXECUTE COMMANDS -------------------------------------------------------*/ + if (strcmp(arg1, "goto") == 0) + { + moveto(playerPtr, arg2, roomPtr_list); + } + else if (strcmp(arg1, "take") == 0) + { + take(playerPtr, arg2, playerPtr->current_room, playerPtr->inventory_size); + } + else if (strcmp(arg1, "look") == 0 || strcmp(arg1, "think") == 0) + { + look(playerPtr); + } + else if (strcmp(arg1, "read") == 0 && strcmp(arg2, "note") == 0) + { + note(playerPtr); + } + else if (strcmp(arg1, "yell") == 0) //some hard-coded commands, yell, cook, rap that don't have their own functions. + { + if (playerPtr->current_room == yardPtr && parkPtr != &park_ran) + { + printf("\033[2J"); + printf("The man in the park ran away.\n\n\n\nPress enter to continue.\n"); + strcpy(yardPtr->look_msg, "There's nobody around.\nIs it Tuesday today?"); + parkPtr = &park_ran; + roomPtr_list[3] = &park_ran; + } + else if (playerPtr->current_room == &park) + printf("I try to yell for help, but there's a bug that distracts me."); + else printf("In the command line, nobody can hear you scream."); + } + else if (strcmp(arg1, "cook") == 0 && strcmp(arg2, "dog poo") == 0) + { + printf("\033[2J"); + for (int i = 0; i < playerPtr->inventory_size; i++) + { + if (playerPtr->inventory[i] != NULL && strcmp(playerPtr->inventory[i], "dog poo") == 0) + { + printf("This is so gross...\nOh, something's stuck in here!\nIt's a note.\nAnd a key!\n\n\nPress enter to continue.\n"); + playerPtr->inventory[i] = NULL; + kitchenPtr->items[0] = "note"; + kitchenPtr->items[1] = "rusty key"; + break; + } + else if (i < playerPtr->inventory_size-1); + else + { + printf("\033[2J"); + print_room_summary(playerPtr); + printf("I don't have any dog poo left to cook :(\n"); + } + } + } + else if (strcmp(arg1, "rap") == 0) + { + if (playerPtr->notes_read < 6) + printf("I don't know any lyrics!"); + else if (playerPtr->current_room != shackPtr) + printf("My rhythm isn't that good. Plus the acoustics in the %s aren't too great.", playerPtr->current_room->room_name); + else + { + running = 0; + printf("\033[2J"); + printf("The shack's energies pour into me as I give the greatest rap ever delivered.\nTo myself.\nIn a shack.\n"); } + } + else if (strcmp(arg1, "") == 0); + else if (strcmp(arg2, "QUIT") == 0 || strcmp(arg1, "QUIT") == 0 ) + running = 0; + else if (strcmp(arg1, "help") == 0) + { + printf("\033[2J"); + printf("Available commands are:\n - goto [location] will print out a statement when you move to the room then print out the new room summary\n - take [item will move the item into your inventory\n - look - print a look summary\n - read note - will display collected notes\n - yell - will make you yell.\n - cook (only in kitchen)\n - QUIT - quits game."); + } + else (printf("I don't know how to do that.")); + /* COMMANDS -------------------------------------------------------*/ + free(arg1); + free(arg2); + + if (playerPtr->current_room == quitPtr) + running = 0; + printf("\n"); + + } + return 0; +} diff --git a/Proposal.txt b/Proposal.txt new file mode 100644 index 0000000..877bf25 --- /dev/null +++ b/Proposal.txt @@ -0,0 +1,28 @@ +Text Adventure Game +A simple text adventure game that allows you to pick up items, look around, and go to different rooms. The story I haven’t figured out yet. + +Todo: +1. Player + a. structure with + i. location (takes room) + ii. inventory – array +2. Inventory + a. array of player structure probably + b. available items could be an enumerator +3. Room structure + a. each room has a summary when you walk into it + b. each room has a different summary for when you look + c. Room summaries can change + d. rooms have items in them that you can take +4. Commands + a. housed in a player command function + b. Look – gives a room’s summary + i. in bag = see inventory + c. Open – goes to a smaller “room” like a cabinet, closet, etc. + d. Go + i. Go back, to previous room. + e. Take – take an item in environment from inventory + f. Help – gives all available commands + g. yell – call something, doesn’t do anything most of the time + h. Hint – Maybe implement suggested commands + i. put – try to put an item in something else diff --git a/README.md b/README.md index 6ff9dd5..34a7e48 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,60 @@ # Final Project -## Objectives -To review and implement concepts learned from class in a self-designed program. - -### Description -You will design, propose, and implement a project of your own choosing. Your project must implement or include each of the following concepts: - - Variables/data types - - Input/output - - Conditional statements - - Loops - - Functions - - Arrays/strings (either directly or as a pointer) - - Advanced data types (structures and enumerated lists)
- -If it is appropriate to use a header file and/or an external .c file containing utility functions, you should do so. If you have more than a few functions in your program, this applies to you. - -Your program must be well-commented and provide the user with information on how to use your program. Interaction with the program should be specified within the program as well as within a readme.txt document. Rules for games should also be included in the readme.txt document. -Additionally, your code must be written efficiently and handle invalid user input appropriately. This means that if you have the user enter a number, and the user enters a string or a character, your program should not crash, go into an infinite loop, or produce anything outside of the expected functionality. - -Examples of projects include (but are not limited to): game simulators (board games, battle arena, other games), text adventure games, artificial intelligence applications, etc. - -Note: There may be functionality you wish to include in your project that we have not gone over yet in class. You can check with your instructor (me) or your TA (Lesley) to see if we intend to go over it or if it is possible. You may wish to temporarily hardcode data, functionality, etc. until we go over it. Your final code for those sections should not be hardcoded. - -### Part 1: Proposal -You must submit a proposal that details the following: - - Descriptive overview of project (what it does, what game it implements/simulates, etc). This should be long enough to explain what your program is and what it does/does not do. - - Detailed examples of concept implementation (an example each of how you will use functions, loops, etc.). You do not need to explain how you will use variables or input/output unless it is not inherently obvious. - - Your reasons for picking this project (you are interested in game design and wanted to create a game, you think the application is interesting and why, etc.). - - Any external libraries you are considering using and what you will use them for. Keep in mind that most of your code should be your own, and we cannot provide any help for external libraries. This includes graphics libraries. You are responsible for learning and figuring them out on your own. Also detail any code you will use that is not yours. - -### Part 2: Project Implementation -You must implement the project as described in your proposal and conforming to the expectations in the Description section. - -Functions and large code blocks should be documented (have comments briefly explaining their purpose, as well as any parameters or return values, if applicable). - -You must include a readme.txt detailing how to run your project, a brief overview of what it does, and a brief explanation of interaction with the program (e.g. “You may enter commands at the >> prompt. For help/suggestions of commands to enter at any time, type ‘help’.” for a text adventure game). If your project is a game or game simulator, you should also include any rules as applicable (e.g. “Go Fish is a game of matching cards. If you suggest a card your opponent has, he/she must give you that card. Likewise, if the opponent asks for a card you have, you must give him/her that card. If no card matches, player draws from the pile. Otherwise, players continue asking for cards until they ask for a card no one has.”). - -Your readme.txt should also detail any changes made that do not follow your original proposal and explain why they differ. - - -### Deliverables -Your proposal should be submitted by 10am on Monday, July 11, 2016. It will either be approved or modification requested by Monday night. Note that if you submit your proposal early, it will likely be evaluated early, and you will be able to begin work on your project as soon as it is approved. Your proposal should be in a .doc, .pdf, or .txt document. - -Your project is due Friday, July 15, 2016 at 4pm. Please submit ALL files (source code, external libraries, data files, and executable). - +It’s a text adventure game. You play as a rap god trying to collect his rap lyric notes. You win when you rap by yourself in a shack. +I picked a text adventure game to do because it seemed accomplishable and I like playing games. + +## Compliation +gcc game.c + +## How to play +Type in commands at the >> prompt. Available commands are: + - goto [location] will print out a statement when you move to the room then print out the new room summary + - take [item] will move the item into your inventory + - look - print a look summary + - read note - will display collected notes + - yell - will make you yell. (doesn't do anything unless you're in the yard) + - cook (only in kitchen) + - QUIT - Quits game + - help - prints this + +## Differences from proposal + - Player has more variables, like inventory size, has_poo, has_backpack, notes_read. + - never implemented enumerator, just used strings instead + - Room summaries can change, though none of them really do as I put in a separate "room" with a different functionality. Room pointers can point to different rooms too, so you can create multiple rooms with the same room name. + - Commands are each their own individual functions and could be called from the get_args function but I didn't have time to really change this so they're all in main. + - Look in bag not implemented, it just prints inventory all the time as it got cumbersome to try to just look in bag + - there is no Open command as it would have made it unnecessarily complicated + - Go is goto + - Help would be easy to put in, though I feel it was redundant as the game is pretty easy. + - put would have also made the game too complicated. + - there are new room-specific commands like cook and rap that help you to win the game. + +## How to win +Use these commands in this order: + - goto bedroom + - take backpack + - take note + - goto yard + - take note + - yell + - goto park + - take note + - take dog poo + - goto yard + - goto kitchen + - cook dog poo + - take note + - take rusty key + - goto yard + - goto shack + - take note + - read note + - rap + +Use these commands to lose the game: + - goto bedroom + - take backpack + - goto yard + - goto park + - goto anywhere +alternatively: QUIT or goto QUIT works well.