forked from AustinCodingAcademy/csharp-workbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Week1-2 #2
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
Forrest-Flowers
wants to merge
6
commits into
master
Choose a base branch
from
week1-2
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
Week1-2 #2
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
945ac08
initial commit
Forrest-Flowers f64a5aa
Mostly done with the Practice, started the Text Game
Forrest-Flowers d5fc792
Finished up Practice.
Forrest-Flowers 898b071
Started textGame
Forrest-Flowers b4ab184
got to beginning of spider fight in text game
Forrest-Flowers f894527
textgame finished
Forrest-Flowers 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,143 @@ | ||
| using System; | ||
| using System.Threading; | ||
|
|
||
|
|
||
| namespace textGame | ||
| { | ||
| class Program | ||
| { | ||
| static void Main(string[] args) | ||
| { | ||
| Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
| Console.WriteLine("Welcome to the cavern of secrets!"); | ||
| Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
| Thread.Sleep(2000); | ||
|
|
||
| String ch1; | ||
| String ch2; | ||
| String ch3; | ||
| bool stick = false; | ||
|
|
||
| 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 pick up the stick? [y/n]"); | ||
| ch1 = Console.ReadLine(); | ||
|
|
||
| // STICK TAKEN | ||
| if (ch1 == "y" || ch1 == "Y" || ch1 == "Yes" || ch1 == "YES" || ch1 == "yes"){ | ||
| Console.WriteLine("You pick up the stick!"); | ||
| Thread.Sleep(2000); | ||
| stick = true; | ||
| }//STICK NOT TAKEN | ||
| else{ | ||
| Console.WriteLine("You pass up the Stick."); | ||
| Thread.Sleep(2000); | ||
| stick = false; | ||
| } | ||
|
|
||
| Console.WriteLine("As you proceed further into the cave, you see a small glowing object"); | ||
| Console.WriteLine("Do you approach the object? [y/n]"); | ||
| ch2 = Console.ReadLine(); | ||
|
|
||
| //FIGHT OR FLIGHT | ||
| if(ch2 == "y" || ch2 == "Y" || ch2 == "Yes" || ch2 == "YES" || ch2 == "yes"){ | ||
| Console.WriteLine("You approach the object..."); | ||
| Thread.Sleep(2000); | ||
| Console.WriteLine("As you draw closer, you begin to make out the object as an eye!"); | ||
| Thread.Sleep(1000); | ||
| Console.WriteLine("The eye belongs to a giant spider!"); | ||
| Console.WriteLine("Do you try to fight it? [Y/N]"); | ||
| ch3 = Console.ReadLine(); | ||
|
|
||
| //FIGHT SPIDER | ||
| if(ch3 == "y" || ch3 == "Y" || ch3 == "Yes" || ch3 == "YES" || ch3 == "yes"){ | ||
|
|
||
| //HAS A STICK | ||
| if(stick == true){ | ||
| Console.WriteLine("You only have a stick to fight with!"); | ||
| Console.WriteLine("You quickly jab the spider in it's eye to gain an advantage."); | ||
| Thread.Sleep(2000); | ||
| 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
|
|
||
| int fdmg1; | ||
| int edmg1; | ||
| Random dmg = new Random(); | ||
|
|
||
|
|
||
| fdmg1 = dmg.Next(3, 11); | ||
| Console.WriteLine("You hit for {0} damage!", fdmg1); | ||
|
|
||
| edmg1 = dmg.Next(1,6); | ||
| Console.WriteLine("The spider hits for {0} damage!", edmg1); | ||
| Console.ReadLine(); | ||
|
|
||
| if(edmg1 > fdmg1){ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only cosmetic, but the indentation on this set of if/else is off. |
||
| Console.WriteLine("The spider has done more damage than you!"); | ||
| return; | ||
| }else if(fdmg1 < 5){ | ||
| Console.WriteLine("You don't do enough damage to kill the spider, but you manage to wound it!"); | ||
|
|
||
| return; | ||
| }else if(fdmg1 > 5){ | ||
| Console.WriteLine("You killed the spider!"); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| }// NOSTICK | ||
| else{ | ||
| Console.WriteLine("You don't have anything to fight with!"); | ||
| Thread.Sleep(2000); | ||
| 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
|
|
||
| int fdmg0; | ||
| int edmg0; | ||
| Random dmg = new Random(); | ||
|
|
||
| fdmg0 = dmg.Next(1, 9); | ||
| Console.WriteLine("You hit for {0} damage!", fdmg0); | ||
|
|
||
| edmg0 = dmg.Next(1,6); | ||
| Console.WriteLine("The spider hits for {0} damage!", edmg0); | ||
| Console.ReadLine(); | ||
| if(edmg0 > fdmg0){ | ||
| Console.WriteLine("The spider has done more damage than you!"); | ||
| return; | ||
|
|
||
| }else if(fdmg0 < 5){ | ||
| Console.WriteLine("You don't do enough damage to kill the spider, but you manage to wound it!"); | ||
| return; | ||
| }else if(fdmg0 > 5){ | ||
| Console.WriteLine("You killed the spider!"); | ||
| return; | ||
| } | ||
|
|
||
| }//END NOSTICK FIGHT | ||
|
|
||
| }//END FIGHT SPIDER | ||
| else{ | ||
| Console.WriteLine("You choose not to fight the spider."); | ||
| Thread.Sleep(1000); | ||
| Console.WriteLine("As you turn away, it ambushes you and impales you with it's fangs!!!"); | ||
| return; | ||
| } | ||
|
|
||
| }//END FIGHT OR FLIGHT | ||
| else{ | ||
| Console.WriteLine("You turn away from the glowing object, and attempt to leave the cave..."); | ||
| Thread.Sleep(1000); | ||
| Console.WriteLine("But something won't let you...."); | ||
| return; | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
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.1</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
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,65 @@ | ||
| using System; | ||
|
|
||
| namespace week1_practice | ||
| { | ||
| class Program | ||
| { | ||
| static void Main(string[] args) | ||
| { // ints for add function. | ||
| int num1; | ||
| int num2; | ||
| int total; | ||
|
|
||
| // Write the first number in the problem | ||
| Console.WriteLine("Please enter an integer you would like to add:"); | ||
| num1 = Convert.ToInt32(Console.ReadLine()); | ||
|
|
||
| // Write the second number. | ||
| Console.WriteLine("And the second integer:"); | ||
| num2 = Convert.ToInt32(Console.ReadLine()); | ||
| total = num1 + num2; | ||
|
|
||
| //Let's add em up. | ||
|
|
||
| Console.WriteLine("{0} + {1} = {2}", num1, num2, total); | ||
|
|
||
| //End of adding program. | ||
|
|
||
|
|
||
| // The two ints we're working with. | ||
| int yards = 1; | ||
| int inches = yards * 36; | ||
|
|
||
| // Converts yards to inches. Mission accomplished. | ||
| Console.WriteLine("{0} yard(s) is equal to {1} inches.", yards, inches); | ||
|
|
||
| bool People = true; | ||
| var f = false; | ||
|
|
||
| // Take var num and multiply it by itself. | ||
| decimal num = 1.49m; | ||
| Console.WriteLine(num * num); | ||
| // Make var num an integer. | ||
| int intnum = Convert.ToInt32(num); | ||
| Console.WriteLine(intnum); | ||
|
|
||
| //Personal Info | ||
| string firstName = "Forrest"; | ||
| string lastName= "Flowers"; | ||
| string age = "19"; | ||
| string job = "Amateur Developer"; | ||
| string favoriteBand = "Streetlight Manifesto"; | ||
| // string favoriteSportsTeam = "N/A"; | ||
|
|
||
| //Writes out my amazing introduction. | ||
| Console.WriteLine("Hi, my name is {0} {1} and I am {2} years old. I work as a {3}, and my favorite band is {4}.", firstName, lastName, age, job, favoriteBand); | ||
|
|
||
|
|
||
| Console.WriteLine(100 * 10); | ||
| Console.WriteLine(100 / 10); | ||
| Console.WriteLine(100 + 10); | ||
| Console.WriteLine(100 - 10); | ||
|
|
||
| } | ||
| } | ||
| } |
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,9 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>netcoreapp2.1</TargetFramework> | ||
| <RootNamespace>week1_practice</RootNamespace> | ||
| </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.
Only cosmetic, but your indentation is off.