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 new file mode 100644 index 00000000..3bedfef3 --- /dev/null +++ b/TextGame/TextGame.cs @@ -0,0 +1,202 @@ +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(); + spiderEncounter(); + + } + + 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 + 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 + } +} + + + //string ch3 = Console.ReadLine("Do you try to fight it? [Y/N]"); + + //# FIGHT SPIDER + /*if (ch3.ToLower() =='y', '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"); + 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 ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + 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); + userInput = Console.ReadLine(); + + if (edmg1 > fdmg1) + Console.WriteLine ("The spider has dealt more damage than you!"); + complete = 0 + return complete + + else if (fdmg1 < 5) + { + + Console.WriteLine ("You didn't do enough damage to kill the spider, but you manage to escape"); + complete = 1; + } + + else + { + Console.WriteLine ("You killed the spider!"); + complete = 1; + } + } +} + //# WITHOUT STICK + else: + Console.WriteLine ("You don't have anything to fight with!"); + 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 ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + 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; + 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."); + 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 +else: + 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 +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..23df6047 --- /dev/null +++ b/TextGame/TextGame.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + +