forked from AustinCodingAcademy/csharp-workbook
-
Notifications
You must be signed in to change notification settings - Fork 0
02week 1 #6
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
jsnconnolly
wants to merge
7
commits into
master
Choose a base branch
from
02week-1
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
02week 1 #6
Changes from all commits
Commits
Show all changes
7 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 |
|---|---|---|
| @@ -1,12 +1,40 @@ | ||
| using System; | ||
|
|
||
| namespace HelloWorld | ||
| public class Program | ||
| { | ||
| class Program | ||
| { | ||
| static void Main(string[] args) | ||
| { | ||
| Console.WriteLine("Hello World!"); | ||
| } | ||
| } | ||
| public static void Main() | ||
| { | ||
| string name = ""; | ||
| string lastname = ""; | ||
| int age = 0; | ||
| int year = 7; | ||
| string band = ""; | ||
| string team = ""; | ||
|
|
||
|
|
||
|
|
||
| Console.WriteLine("Please enter your first name: "); | ||
| name = Console.ReadLine(); | ||
| Console.WriteLine("Please enter your last name: "); | ||
| lastname = Console.ReadLine(); | ||
| Console.WriteLine("Please enter your age: "); | ||
| age = Convert.ToInt32(Console.ReadLine()); | ||
| //Console.WriteLine("Please enter 7: "); | ||
| //year = Convert.ToInt32(Console.ReadLine()); | ||
| //comment: put divisibale into line 10 | ||
| Console.WriteLine("Who is your favorite band: "); | ||
| band = Console.ReadLine(); | ||
| Console.WriteLine("What sports team do you cheer for: "); | ||
| team = Console.ReadLine(); | ||
|
|
||
|
|
||
| Console.WriteLine(@"Hello! | ||
| My name is {0} {1}. | ||
| I am {3} in dog years. | ||
| My favorite band is {4}. | ||
| I support {5}! " , name, lastname, age, year*age, band, team); | ||
|
|
||
|
|
||
|
|
||
| } | ||
| } |
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
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,186 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace TextGame | ||
| { | ||
| class Program | ||
| { | ||
|
|
||
|
|
||
| static void Main(string[] args) | ||
| { | ||
| Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
| Console.WriteLine("Welcome to the cavern of secrets!"); | ||
| Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
| takerofstick(); | ||
|
|
||
| } | ||
|
|
||
| static void takerofstick() | ||
| { | ||
|
|
||
| Console.WriteLine("You enter a dark cavern out of curiosity. It is dark and you can only make out a small stick on the floor."); | ||
| Console.WriteLine("Do you take it? [y/n]: "); | ||
| string userInput = Console.ReadLine(); | ||
| int stick; | ||
|
|
||
| if (userInput.ToLower() == "yes") | ||
| /*converts all inputs to lower case */ | ||
| { | ||
| Console.WriteLine("You have taken the stick!"); | ||
| stick = 1; | ||
| } | ||
| else | ||
| { | ||
| Console.WriteLine("You did not take the stick"); | ||
| stick = 0; | ||
| } | ||
|
|
||
|
|
||
| Console.WriteLine ("As you proceed further into the cave, you see a small glowing object"); | ||
| Console.WriteLine ("Do you approach the object? [y/n]"); | ||
|
|
||
| string chapter2 = Console.ReadLine(); | ||
|
|
||
|
|
||
| Console.WriteLine("You enter a dark cavern out of curiosity. It is dark and you can only make out a small stick on the floor."); | ||
| Console.WriteLine("Do you take it? [y/n]: "); | ||
| /* } | ||
| } | ||
| }*/ | ||
| /*# STICK TAKEN*/ | ||
| if (userInput.ToLower() == "yes") | ||
| { | ||
| Console.WriteLine("You have taken the stick!"); | ||
| stick = 1; | ||
| } | ||
| /*# STICK NOT TAKEN*/ | ||
| else | ||
| { | ||
| Console.WriteLine("You did not take the stick"); | ||
| stick = 0; | ||
| } | ||
| Console.WriteLine("As you proceed further into the cave, you see a small glowing object"); | ||
| Console.WriteLine("Do you approach the object? [y/n]"); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /*# APPROACH SPIDER | ||
| if (userInput.ToLower() == "yes") | ||
| Console.WriteLine ("You approach the object...") | ||
| time.sleep(2) | ||
| Console.WriteLine ("As you draw closer, you begin to make out the object as an eye!") | ||
| time.sleep(1) | ||
| Console.WriteLine ("The eye belongs to a giant spider!") | ||
| ch3 = str(input("Do you try to fight it? [Y/N]")) | ||
|
|
||
| # FIGHT SPIDER | ||
| if ch3 in ['y', 'Y', 'Yes', 'YES', 'yes']: | ||
|
|
||
| # WITH STICK | ||
| if stick == 1: | ||
| Console. WriteLine ("You only have a stick to fight with!"); | ||
| Console.WriteLine ("You quickly jab the spider in it's eye and gain an advantage"); | ||
| time.sleep(2) | ||
| Console.WriteLine ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
| Console.WriteLine (" Fighting... "); | ||
| Console.WriteLine (" YOU MUST HIT ABOVE A 5 TO KILL THE SPIDER "); | ||
| Console.WriteLine ("IF THE SPIDER HITS HIGHER THAN YOU, YOU WILL DIE"); | ||
| Console.WriteLine ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
| time.sleep(2) | ||
| fdmg1 = int(random.randint(3, 10)) | ||
| edmg1 = int(random.randint(1, 5)) | ||
| Console.WriteLine ("you hit a", fdmg1); | ||
| Console.WriteLine ("the spider hits a", edmg1); | ||
| time.sleep(2) | ||
|
|
||
| if edmg1 > fdmg1: | ||
| Console.WriteLine ("The spider has dealt more damage than you!"); | ||
| complete = 0 | ||
| return complete | ||
|
|
||
| elif fdmg1 < 5: | ||
| Console.WriteLine ("You didn't do enough damage to kill the spider, but you manage to escape"); | ||
| complete = 1 | ||
| return complete | ||
|
|
||
| else: | ||
| Console.WriteLine ("You killed the spider!"); | ||
| complete = 1 | ||
| return complete | ||
|
|
||
| # WITHOUT STICK | ||
| else: | ||
| Console.WriteLine ("You don't have anything to fight with!"); | ||
| Console.WriteLinesleep(2); | ||
| Console.WriteLine ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
| Console.WriteLine (" Fighting... "); | ||
| Console.WriteLine (" YOU MUST HIT ABOVE A 5 TO KILL THE SPIDER "); | ||
| Console.WriteLine ("IF THE SPIDER HITS HIGHER THAN YOU, YOU WILL DIE"); | ||
| Console.WriteLine ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
| time.sleep(2) | ||
| fdmg1 = int(random.randint(1, 8)) | ||
| edmg1 = int(random.randint(1, 5)) | ||
| Console.WriteLine ("you hit a", fdmg1) | ||
| Console.WriteLine ("the spider hits a", edmg1) | ||
| time.sleep(2) | ||
|
|
||
| if edmg1 > fdmg1: | ||
| Console.WriteLine ("The spider has dealt more damage than you!") | ||
| complete = 0 | ||
| return complete | ||
|
|
||
| elif fdmg1 < 5: | ||
| Console.WriteLine ("You didn't do enough damage to kill the spider, but you manage to escape") | ||
| complete = 1 | ||
| return complete | ||
|
|
||
| else: | ||
| Console.WriteLine ("You killed the spider!") | ||
| complete = 1 | ||
| return complete | ||
|
|
||
| #DON'T FIGHT SPIDER | ||
| Console.WriteLine ("You choose not to fight the spider.") | ||
| time.sleep(1) | ||
| Console.WriteLine ("As you turn away, it ambushes you and impales you with it's fangs!!!") | ||
| complete = 0 | ||
| return complete | ||
|
|
||
| # DON'T APPROACH SPIDER | ||
| else: | ||
| Console.WriteLine ("You turn away from the glowing object, and attempt to leave the cave...") | ||
| time.sleep(1) | ||
| Console.WriteLine ("But something won't let you....") | ||
| time.sleep(2) | ||
| complete = 0 | ||
| return complete | ||
|
|
||
| # game loop | ||
| alive = True | ||
| while alive: | ||
|
|
||
| complete = game() | ||
| if complete == 1: | ||
| alive = input('You managed to escape the cavern alive! Would you like to play again? [y/n]: ') | ||
| if alive in ['y', 'Y', 'YES', 'yes', 'Yes',]: | ||
| alive | ||
|
|
||
| else: | ||
| break | ||
|
|
||
| else: | ||
| alive = input('You have died! Would you like to play again? [y/n]: ') | ||
| if alive in ['y', 'Y', 'YES', 'yes', 'Yes',]: | ||
| alive | ||
|
|
||
| else: | ||
| break | ||
|
|
||
| } | ||
| } | ||
| } | ||
| */ |
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 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>netcoreapp2.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
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.
this only does the correct thing if the vowel is the first letter in the word.