-
Couldn't load subscription status.
- Fork 22
Add files via upload #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
portemilio
wants to merge
2
commits into
CPRO-Session1:master
Choose a base branch
from
portemilio:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Andrew Zihenni | ||
| Proposal: | ||
| I'm going to create a text adventure game. The player is | ||
| stranded on an island alone. The objective is to create a | ||
| boat to get back home. This game is going to | ||
| consist of six different locations. On each location will | ||
| be a different set of items that will help the player build the boat. | ||
| After the player visits each location and chooses the items he/she | ||
| believes will help him/her, the item goes back to the beach. Once you get | ||
| the necessary items that will allow you to create the boat, the game ends. | ||
| Conceptually, I will be using different functions to create this program. | ||
| I'll also need a lot of If statements so that if the person chooses an object | ||
| from one of the locations, it goes to the beach where it is stored and printed. | ||
| Although I don't think loops will be necessary, they might find their way in my project | ||
| if deemed necessary. | ||
| Thanks | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Andrew Zihenni | ||
|
|
||
| My final project is a text-based adventure game. It consists of a user being stranded on an island, and he has to go through the various steps | ||
| to get the equipment to build a boat and get back home. | ||
| To finish the game, the answers are in this order: | ||
| 1, 2, 1, 1, 3, 1, 3, 3, 1. | ||
| I wanted to incorporate enum's and structures in my project, but I just couldn't find a way to do so. Also, I was trying to create a restart button | ||
| using a while loop, but every time I tried to make it, it just ended up not compiling/giving me logic errors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| #include <stdio.h> | ||
|
|
||
|
|
||
| int main () { | ||
|
|
||
|
|
||
| int exit1, choice1, choice2, choice3, choice4, choice5, choice6, choice7, choice8; | ||
| char name[50]; | ||
| printf ("Enter your name, adventurer.\n"); | ||
| scanf ("%s", name); | ||
| printf ("Hello %s.\n", name); | ||
| printf ("You are stranded on an island alone. You have a limited supply of food and resources.\n"); | ||
| printf ("Your goal is to travel to different locations within the island and find supplies that will\nhelp you build a boat and get back home.\n"); | ||
| printf ("Your first location is the Beach.\n1. Go to the Beach.\n2. Exit this game.\n"); | ||
| scanf ("%d", &exit1); | ||
| if (exit1 == 1) { | ||
| printf ("You decided to travel to the Beach. You found a key and a chest. You open the chest and find a pile of wood. Unfortunately, it is guarded by a snake.\nWhat would you like to do?\n 1. Kill the Snake. \n 2. Run Away.\n"); | ||
| } | ||
| else if (exit1 == 2) { | ||
| printf ("You are no real adventurer. GAME OVER.\n"); | ||
| } | ||
| scanf ("%d", &choice1); | ||
| if (choice1 == 1) { | ||
| printf ("You decided to kill the snake. Unfortunately, you died.\nGAME OVER.\n"); | ||
| } | ||
| else if (choice1 == 2) { | ||
| printf ("Smart move %s, you'll find another way to get wood!\n", name); | ||
| } | ||
|
|
||
| printf ("\n"); | ||
| printf ("After wandering for a couple hours on the island, you come along an abandoned warehouse. You hear something inside.\n"); | ||
| printf ("1. Go inside.\n2. Run.\n"); | ||
| scanf ("%d", &choice2); | ||
| if (choice2 == 1) { | ||
| printf ("Despite your fear of the dark, you decide to go inside the abandoned mansion. Coincidentally, you find a pile of wood. Congratulations %s!\n", name); | ||
| printf ("\n"); | ||
| } | ||
| else if (choice2 == 2) { | ||
| printf ("Only LOSERS run away.\nGAME OVER\n"); | ||
|
|
||
| } | ||
|
|
||
| printf ("While returning to the beach to put away your newly found wood, you hear something mysterious. Fortunately, you find a knife on the ground and keep it close to your body.\nA couple of minutes later, you see a tribe of monkeys guarding something.\nAs you approach the tribe, two monkeys jump and attack you. Is it worth fighting them to see what they are guarding?\n"); | ||
| printf ("1. Yes\n2. No.\n"); | ||
| scanf ("%d", &choice3); | ||
| if (choice3 == 1) { | ||
| printf ("You are one crazy adventurer. You fight off the monkeys and find out that they were guarding a sail. Good job %s!\n", name); | ||
| } | ||
| else if (choice3 == 1) { | ||
| printf ("If you ever get the chance to meet a tribe of monkeys, you better take it %s!\n GAME OVER!\n", name); | ||
| } | ||
|
|
||
| printf ("Your food is running short. You don't have much time left. All you have is a sail and some wood. You're going to have to hurry up %s!\n", name); | ||
| printf ("What would you like to do?\n1. Give up and exit the game!\n2. Cry yourself to death.\n3. Be the hero you always were and keep on going!\n"); | ||
| scanf ("%d", &choice4); | ||
| for (choice4 == 1; choice4 <= 3; choice4++) { | ||
| if (choice4 == 1 | choice4 ==2) { | ||
| printf ("You're no warrior %s. Get out of here!\n GAME OVER!\n", name); | ||
| } | ||
| else if (choice4 == 3) { | ||
| printf ("You truly are an adventurer %s! As a result of your extreme courage, a random flying engine appears infront of you. You have all the components to create your boat!\n", name); | ||
| } | ||
| printf ("Press 1 to go back to the beach.\n"); | ||
| scanf ("%d", &choice5); | ||
| if (choice5 == 1) { | ||
| printf ("You have arrived at the beach. Time for the construction of the boat!\n"); | ||
| } | ||
| else if (choice5 != 1) { | ||
| printf ("Not a valid answer; however, I'll let you get away with it this time %s!\n", name); | ||
| break; | ||
| } | ||
|
|
||
| } | ||
| printf ("\n"); | ||
| printf ("You're going to need a hammer to complete this job.\nTravel to the nearest cave to find one."); | ||
| printf ("Which cave would you like to go to?\n1. The cave of DOOM!\n2. The Cave of Tranquility!\n3. The Cave of the Worker!"); | ||
| scanf ("%d", &choice6); | ||
| for (choice6 == 1; choice6 <= 3; choice6++) { | ||
| if (choice6 == 1 | choice6 == 2) { | ||
| printf ("The answer was right infront of your eyes; yet, you somehow missed it %s!\n GAME OVER!\n", name); | ||
| } | ||
| else if (choice6 == 3) { | ||
| printf ("You chose to go to The Cave of the Worker! Wise choice %s!\n", name); | ||
| } | ||
| } | ||
| printf ("As you travel to the cave, four human beings jump on you. Surprised and confused, you pass out for over 8 hours!\n"); | ||
| printf ("They take you into the 'abandoned warehouse' in which you previously were\n"); | ||
| printf ("You see a Nokia phone on the floor. This might be your last chance at survival. What do you do?\n"); | ||
| printf ("1. Take the phone\n2. Don't take the phone.\n3. I don't believe Nokias are phones, so I'll just sit and wait for a better way out\n"); | ||
| scanf ("%d", &choice7); | ||
| if (choice7 == 1) { | ||
| printf ("That would be a smart decision, but you can't seem to remember anyone's phone number.\n GAME OVER!\n"); | ||
| } | ||
| else if (choice7 == 2) { | ||
| printf ("At least give it a shot, what else are you going to do %s?!", name); | ||
| } | ||
| else if (choice7 == 3) { | ||
| printf ("Surprisingly, you're right.\n As a result of your wise and well-thought out decision, I grant you, as a spectator of your journey, the hammer for which you had been looking.\n Get back to the beach quickly so you can finally get back home!"); | ||
| printf ("\n"); | ||
| printf ("Press 1 to go back to the beach %s!", name); | ||
| scanf ("%d", &choice8); | ||
| if (choice8 == 1) { | ||
| printf ("After 3 hours of walking, you finally made it to the Beach.\n You construct your boat using your newly found hammer.\n Although it took you a while to build the boat, you manage to do so with ease and get back home with only a couple of scratches and a hint of malaria.\n CONGRATULATIONS %s, you WON THE GAME!\n", name); | ||
| } | ||
| else if (choice8 != 1) { | ||
| printf ("Invalid answer.\n GAME OVER!"); | ||
|
|
||
|
|
||
|
|
||
| } | ||
| } | ||
| return 0; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will enums or structs be used? And you should find a way to incorporate loops into your program!