From 3f05110b1a6be66b9e49d455713faf1f4bcafec0 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Tue, 17 Jul 2018 15:08:33 -0500 Subject: [PATCH 1/7] TextGame --- TextGame/Program.cs | 181 +++++++++++++++++++++++++++++++++++++++ TextGame/TextGame.csproj | 8 ++ 2 files changed, 189 insertions(+) create mode 100644 TextGame/Program.cs create mode 100644 TextGame/TextGame.csproj diff --git a/TextGame/Program.cs b/TextGame/Program.cs new file mode 100644 index 00000000..53551944 --- /dev/null +++ b/TextGame/Program.cs @@ -0,0 +1,181 @@ +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") + { + 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 input ['y', 'Y', 'Yes', 'YES', 'yes'] + Console.WriteLine("You have taken the stick!") + Thread.Sleep (2); + int 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") +ch2 = str(input("Do you approach the object? [y/n]")) + +# APPROACH SPIDER +if ch2 in ['y', 'Y', 'Yes', 'YES', '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 + + } + } +} + */ \ No newline at end of file diff --git a/TextGame/TextGame.csproj b/TextGame/TextGame.csproj new file mode 100644 index 00000000..ce1697ae --- /dev/null +++ b/TextGame/TextGame.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.0 + + + From 4181d54570f471007622ddfaec45bbfcd140313b Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Tue, 17 Jul 2018 15:12:09 -0500 Subject: [PATCH 2/7] TextGame --- TextGame/{Program.cs => TextGame.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename TextGame/{Program.cs => TextGame.cs} (100%) diff --git a/TextGame/Program.cs b/TextGame/TextGame.cs similarity index 100% rename from TextGame/Program.cs rename to TextGame/TextGame.cs From 9305cfbe64f66fe62864a6e9b69f4e8839333192 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 18 Jul 2018 12:30:31 -0500 Subject: [PATCH 3/7] TextGame --- TextGame/TextGame.cs | 99 +++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 47 deletions(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 53551944..817e1dd4 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -27,49 +27,54 @@ static void takerofstick() int stick; if (userInput.ToLower() == "yes") - { + /*converts all inputs to lower case */ + { Console.WriteLine("You have taken the stick!"); - stick = 1; - } - else{ + 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]"); + 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]"); } } } -/* -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 input ['y', 'Y', 'Yes', 'YES', 'yes'] - Console.WriteLine("You have taken the stick!") - Thread.Sleep (2); - int 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") -ch2 = str(input("Do you approach the object? [y/n]")) - -# APPROACH SPIDER -if ch2 in ['y', 'Y', 'Yes', 'YES', 'yes']: - Console.WriteLine ("You approach the object...") +/*# 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!") + 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!") + Console.WriteLine ("The eye belongs to a giant spider!") ch3 = str(input("Do you try to fight it? [Y/N]")) # FIGHT SPIDER @@ -77,45 +82,45 @@ static void takerofstick() # 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") + 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 ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") + 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) + 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!") + 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") + 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!") + 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 ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") + 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)) From 2b3181e727a838efc18be22ef84919ddaa68ad20 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 18 Jul 2018 12:33:16 -0500 Subject: [PATCH 4/7] HelloMod --- HelloWorld/HelloWorld.cs | 46 ++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/HelloWorld/HelloWorld.cs b/HelloWorld/HelloWorld.cs index 8168c805..c30dbd7c 100644 --- a/HelloWorld/HelloWorld.cs +++ b/HelloWorld/HelloWorld.cs @@ -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,); + + + + } } From 00e48c0df2a38fcdeaa121c6bbc015394a273a9d Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 18 Jul 2018 12:49:26 -0500 Subject: [PATCH 5/7] HelloWorld --- HelloWorld/HelloWorld.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HelloWorld/HelloWorld.cs b/HelloWorld/HelloWorld.cs index c30dbd7c..967b4ea5 100644 --- a/HelloWorld/HelloWorld.cs +++ b/HelloWorld/HelloWorld.cs @@ -32,7 +32,7 @@ public static void Main() 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,); + I support {5}! " , name, lastname, age, year*age, band, team); From af04404a7a3d4509d86aad372a5aed1b82eeb32f Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 23 Jul 2018 12:35:39 -0500 Subject: [PATCH 6/7] PigLatin --- PigLatin/PigLatin.cs | 49 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/PigLatin/PigLatin.cs b/PigLatin/PigLatin.cs index 702647dd..e451a0dd 100644 --- a/PigLatin/PigLatin.cs +++ b/PigLatin/PigLatin.cs @@ -4,18 +4,49 @@ namespace PigLatin { class Program { - public static void Main() + static void Main(string[] args) + { + Console.WriteLine("Enter a word/sentence to convert to PigLatin:"); + string sentence = Console.ReadLine(); + string pigLatin = ToPigLatin(sentence); + Console.WriteLine(pigLatin); + } + + static string ToPigLatin (string sentence) + { + string firstLetter, + restOfWord, + vowels = "AEIOUaeio"; + int currentLetter; + + foreach (string word in sentence.Split()) { - // your code goes here + firstLetter = sentence.Substring(0, 1); + restOfWord = sentence.Substring(1, sentence.Length - 1); + currentLetter = vowels.IndexOf(firstLetter); - // leave this command at the end so your program does not close automatically - Console.ReadLine(); + if (currentLetter == -1) + { + sentence = restOfWord + firstLetter + "ay"; + } + else + { + sentence = word + "yay"; + } } - - public static string TranslateWord(string word) - { - // your code goes here - return word; + + return sentence; } } } + //leave this command at the end so your program does not close automatically + //Console.ReadLine(); + //} + + //public static string TranslateWord(string word) + //{ + // your code goes here + // return word; + //} + // } +//} From 8fabdd1a6fe7e70b35c3e4fcc3ed5c6f902d7f67 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 1 Aug 2018 16:08:57 -0500 Subject: [PATCH 7/7] PigLatin --- PigLatin/PigLatin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PigLatin/PigLatin.cs b/PigLatin/PigLatin.cs index e451a0dd..fb1c590e 100644 --- a/PigLatin/PigLatin.cs +++ b/PigLatin/PigLatin.cs @@ -6,7 +6,7 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Enter a word/sentence to convert to PigLatin:"); + Console.WriteLine("Enter a word to PigLatin:"); string sentence = Console.ReadLine(); string pigLatin = ToPigLatin(sentence); Console.WriteLine(pigLatin);