From 28027c004371fd4336d8096b950ce3444a2ef8f5 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 16 Jul 2018 10:44:01 -0500 Subject: [PATCH 1/9] TextGame --- TextGame/Program.cs | 147 +++++++++++++++++++++++++++++++++++++++ TextGame/TextGame.csproj | 8 +++ 2 files changed, 155 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..f742f2ab --- /dev/null +++ b/TextGame/Program.cs @@ -0,0 +1,147 @@ +using System; + +namespace TextGame +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Console.WriteLine("Welcome to the cavern of secrets!"); + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + + +time.sleep(3) + +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 ch1 in ['y', 'Y', 'Yes', 'YES', 'yes']: + Console.WriteLine("You have taken the stick!") + time.sleep(2) + 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: + print ("You only have a stick to fight with!") + print ("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 + + } + } +} diff --git a/TextGame/TextGame.csproj b/TextGame/TextGame.csproj new file mode 100644 index 00000000..23df6047 --- /dev/null +++ b/TextGame/TextGame.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + From 922ccab687501b9e92f8e7cfcd07b9768c6cc143 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 16 Jul 2018 18:13:43 -0500 Subject: [PATCH 2/9] TextGame --- TextGame/Program.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/TextGame/Program.cs b/TextGame/Program.cs index f742f2ab..2c766e00 100644 --- a/TextGame/Program.cs +++ b/TextGame/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Threading; namespace TextGame { @@ -11,17 +12,18 @@ static void Main(string[] args) Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); -time.sleep(3) - +Thread.Sleep(3); + /* trying to figur time for sleep */ + 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]: ")) - +/*Console.WriteLine("Do you take it? [y/n]: ")) + # STICK TAKEN -if ch1 in ['y', 'Y', 'Yes', 'YES', 'yes']: +if ch1 in ['y', 'Y', 'Yes', 'YES', 'yes'] Console.WriteLine("You have taken the stick!") - time.sleep(2) + Thread.Sleep (2); stick = 1 - + # STICK NOT TAKEN else: Console.WriteLine("You did not take the stick") @@ -44,8 +46,8 @@ static void Main(string[] args) # WITH STICK if stick == 1: - print ("You only have a stick to fight with!") - print ("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... ") From b70a869e2ebfeb4237081bfc2e97e8cc6459c27c Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 18 Jul 2018 18:19:13 -0500 Subject: [PATCH 3/9] TextGame --- TextGame/Program.cs | 130 ++++++++++++++++++++++++++++---------------- 1 file changed, 84 insertions(+), 46 deletions(-) diff --git a/TextGame/Program.cs b/TextGame/Program.cs index 2c766e00..81de466c 100644 --- a/TextGame/Program.cs +++ b/TextGame/Program.cs @@ -1,90 +1,127 @@ 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(); + } -Thread.Sleep(3); - /* trying to figur time for sleep */ - -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 ch1 in ['y', 'Y', 'Yes', 'YES', 'yes'] - Console.WriteLine("You have taken the stick!") - Thread.Sleep (2); - stick = 1 + 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; + } -# 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]")) + 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]"); + } + } +} - # FIGHT SPIDER +/*# APPROACH SPIDER + if (userInput.ToLower() == "yes"); + { + Console.WriteLine("You approach the object..."); + userInput = Console.ReadLine(); + Console.WriteLine("As you draw closer, you begin to make out the object as an eye!"); + userInput = Console.ReadLine(); + Console.WriteLine("The eye belongs to a giant spider!"); + } + + string chapter3 = Console.ReadLine("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") + 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)) @@ -147,3 +184,4 @@ Console. WriteLine ("You only have a stick to fight with!") } } } + */ \ No newline at end of file From bd771c286df01205527f0d5484e7ffca0e0c3b56 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 18 Jul 2018 18:20:44 -0500 Subject: [PATCH 4/9] 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 7fdc3f4a717c5f297ae6eb807b46edc56d068a18 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 6 Aug 2018 16:37:34 -0500 Subject: [PATCH 5/9] TextGame --- TextGame/TextGame.cs | 45 ++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 81de466c..7e22b2c7 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -66,7 +66,7 @@ static void takerofstick() } } -/*# APPROACH SPIDER +//# APPROACH SPIDER if (userInput.ToLower() == "yes"); { Console.WriteLine("You approach the object..."); @@ -76,44 +76,49 @@ static void takerofstick() Console.WriteLine("The eye belongs to a giant spider!"); } - string chapter3 = Console.ReadLine("Do you try to fight it? [Y/N]"); + string ch3 = Console.ReadLine("Do you try to fight it? [Y/N]"); - /* # FIGHT SPIDER - if ch3 in ['y', 'Y', 'Yes', 'YES', 'yes']: + //# FIGHT SPIDER + if (ch3.ToLower() =='y', 'Yes'); - # WITH STICK - if stick == 1: + //# 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) + userInput = Console.ReadLine(); 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)) + userInput = Console.ReadLine(); + 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) + userInput = Console.ReadLine(); - if edmg1 > fdmg1: + if (edmg1 > fdmg1) Console.WriteLine ("The spider has dealt more damage than you!"); complete = 0 return complete - elif fdmg1 < 5: + else if (fdmg1 < 5) + { + Console.WriteLine ("You didn't do enough damage to kill the spider, but you manage to escape"); - complete = 1 - return complete + complete = 1; + } - else: + else + { Console.WriteLine ("You killed the spider!"); - complete = 1 - return complete - - # WITHOUT STICK + complete = 1; + } + } +} + /*# WITHOUT STICK else: Console.WriteLine ("You don't have anything to fight with!"); Console.WriteLinesleep(2); From bf3a3bb4c8dc19b8b78923a27ec7506c73f82293 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 6 Aug 2018 18:10:56 -0500 Subject: [PATCH 6/9] TextGame --- TextGame/TextGame.cs | 58 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 7e22b2c7..36270d92 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -48,13 +48,13 @@ 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]: "); -/*# STICK TAKEN*/ + /*# STICK TAKEN*/ if (userInput.ToLower() == "yes") { Console.WriteLine("You have taken the stick!"); stick = 1; } -/*# STICK NOT TAKEN*/ + /*# STICK NOT TAKEN*/ else { Console.WriteLine("You did not take the stick"); @@ -66,7 +66,7 @@ static void takerofstick() } } -//# APPROACH SPIDER + //# APPROACH SPIDER if (userInput.ToLower() == "yes"); { Console.WriteLine("You approach the object..."); @@ -118,54 +118,54 @@ static void takerofstick() } } } - /*# WITHOUT STICK + //# WITHOUT STICK else: Console.WriteLine ("You don't have anything to fight with!"); - Console.WriteLinesleep(2); + userInput = Console.ReadLine(); 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) + userInput = Console.ReadLine(); + 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); + userInput = Console.ReadLine(); if edmg1 > fdmg1: - Console.WriteLine ("The spider has dealt more damage than you!") - complete = 0 + 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 + 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 + 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 + //#DON'T FIGHT SPIDER + Console.WriteLine ("You choose not to fight the spider."); + userInput = Console.ReadLine(); + Console.WriteLine ("As you turn away, it ambushes you and impales you with it's fangs!!!"); + complete = 0; return complete -# DON'T APPROACH SPIDER +//# 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 + Console.WriteLine ("You turn away from the glowing object, and attempt to leave the cave..."); + userInput = Console.ReadLine(); + Console.WriteLine ("But something won't let you...."); + userInput = Console.ReadLine(); + complete = 0; return complete -# game loop +/*# game loop alive = True while alive: From 05f77af56e8157f70c9927fdc4658f82d8adb03f Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 8 Aug 2018 12:13:51 -0500 Subject: [PATCH 7/9] StarWars --- StarWars/StarWars.cs | 93 ++++++++++++++++++++++++++++++++++++++++ StarWars/StarWars.csproj | 8 ++++ TextGame/TextGame.cs | 8 ++-- 3 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 StarWars/StarWars.cs create mode 100644 StarWars/StarWars.csproj diff --git a/StarWars/StarWars.cs b/StarWars/StarWars.cs new file mode 100644 index 00000000..06f99af5 --- /dev/null +++ b/StarWars/StarWars.cs @@ -0,0 +1,93 @@ +using System; + +namespace StarWars +{ + class Program + { + static void Main(string[] args) + { + + Person leia = new Person("Leia", "Organa", "Rebel"); + Person darth = new Person("Darth", "Vader", "Imperial"); + Ship falcon = new Ship("Rebel", "Smuggling", 2); + Ship tie = new Ship("Tie", "Fighter", 1); + + } +} + +class Person +{ + private string firstName; + private string lastName; + private string alliance; + public Person(string firstName, string lastName, string alliance) + { + this.firstName = firstName; + this.lastName = lastName; + this.alliance = alliance; + } + + public string FullName + { + get + { + return this.firstName + " " + this.lastName; + } + + set + { + string[] names = value.Split(' '); + this.firstName = names[0]; + this.lastName = names[1]; + } + } +} + +class Ship +{ + private Person[] passengers; + public Ship(string alliance, string type, int size) + { + this.Type = type; + this.Alliance = alliance; + this.passengers = new Person[size]; + } + + public string Type + { + get; + set; + } + + public string Alliance + { + get; + set; + } + + public string Passengers + { + get + { + foreach (var person in passengers) + { + Console.WriteLine(String.Format("{0}", person.FullName)); + } + + return "That's Everybody!"; + } + } + + public void EnterShip(Person person, int seat) + { + this.passengers[seat] = person; + } + + public void ExitShip(int seat) + { + this.passengers[seat] = null; + } + + } +} + diff --git a/StarWars/StarWars.csproj b/StarWars/StarWars.csproj new file mode 100644 index 00000000..23df6047 --- /dev/null +++ b/StarWars/StarWars.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 36270d92..729d1a00 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -67,19 +67,21 @@ static void takerofstick() } //# APPROACH SPIDER - if (userInput.ToLower() == "yes"); + if (userInput.ToLower() == "yes") { Console.WriteLine("You approach the object..."); + object = 1 userInput = Console.ReadLine(); Console.WriteLine("As you draw closer, you begin to make out the object as an eye!"); + eye = 1 userInput = Console.ReadLine(); Console.WriteLine("The eye belongs to a giant spider!"); } - string ch3 = Console.ReadLine("Do you try to fight it? [Y/N]"); + /* string ch3 = Console.ReadLine("Do you try to fight it? [Y/N]"); //# FIGHT SPIDER - if (ch3.ToLower() =='y', 'Yes'); + /*if (ch3.ToLower() =='y', 'Yes'); //# WITH STICK if (stick == 1) From 9204fee3e6e067e3c647f9d00e9cdc89ee77ee73 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 8 Aug 2018 14:25:43 -0500 Subject: [PATCH 8/9] TextGame --- TextGame/TextGame.cs | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 729d1a00..fa7d809f 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -15,6 +15,7 @@ static void Main(string[] args) Console.WriteLine("Welcome to the cavern of secrets!"); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); takerofstick(); + spiderEncounter(); } @@ -42,19 +43,19 @@ static void takerofstick() 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(); + 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*/ + /*# STICK TAKEN*/ if (userInput.ToLower() == "yes") { Console.WriteLine("You have taken the stick!"); stick = 1; } - /*# STICK NOT TAKEN*/ + /*# STICK NOT TAKEN*/ else { Console.WriteLine("You did not take the stick"); @@ -63,21 +64,28 @@ static void takerofstick() 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 + static void spiderEncounter() + { + string userInput = Console.ReadLine(); + + if (userInput.ToLower() == "yes") + { + Console.WriteLine("You approach the object..."); + userInput = Console.ReadLine(); + Console.WriteLine("As you draw closer, you begin to make out the object as an eye!"); + userInput = Console.ReadLine(); + Console.WriteLine("The eye belongs to a giant spider!"); + } + } + //My Code Here } } - //# APPROACH SPIDER - if (userInput.ToLower() == "yes") - { - Console.WriteLine("You approach the object..."); - object = 1 - userInput = Console.ReadLine(); - Console.WriteLine("As you draw closer, you begin to make out the object as an eye!"); - eye = 1 - userInput = Console.ReadLine(); - Console.WriteLine("The eye belongs to a giant spider!"); - } - + /* string ch3 = Console.ReadLine("Do you try to fight it? [Y/N]"); //# FIGHT SPIDER From 813cf3ae93c6ba641f251317d7b8c35b6ae77a14 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 8 Aug 2018 18:28:52 -0500 Subject: [PATCH 9/9] TextGame --- TextGame/TextGame.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index fa7d809f..3bedfef3 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -71,7 +71,7 @@ static void takerofstick() static void spiderEncounter() { string userInput = Console.ReadLine(); - + if (userInput.ToLower() == "yes") { Console.WriteLine("You approach the object..."); @@ -86,7 +86,7 @@ static void spiderEncounter() } - /* string ch3 = Console.ReadLine("Do you try to fight it? [Y/N]"); + //string ch3 = Console.ReadLine("Do you try to fight it? [Y/N]"); //# FIGHT SPIDER /*if (ch3.ToLower() =='y', 'Yes');