From cf0c1370d5d57cad3372e65ec91bc0bc44aa63f1 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Fri, 5 Oct 2018 14:47:23 -0500 Subject: [PATCH 01/15] week1 practice --- Week1-Practice.cs | 35 ++++++++++++++++++++++++++++ csharp-workbook.csproj | 9 +++++++ week1-Practice/Program.cs | 35 ++++++++++++++++++++++++++++ week1-Practice/week1-Practice.csproj | 9 +++++++ 4 files changed, 88 insertions(+) create mode 100644 Week1-Practice.cs create mode 100644 csharp-workbook.csproj create mode 100644 week1-Practice/Program.cs create mode 100644 week1-Practice/week1-Practice.csproj diff --git a/Week1-Practice.cs b/Week1-Practice.cs new file mode 100644 index 00000000..84a82396 --- /dev/null +++ b/Week1-Practice.cs @@ -0,0 +1,35 @@ +using System; + +public class Program +{ + 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:"); + // ReadLine enters the string + name = Console.ReadLine(); + Console.WriteLine("Please enter your last name:"); + lastname = Console.ReadLine(); + Console.WriteLine("Please enter your age:"); + // Convert.ToInt32 takes in the numbers + age = Convert.ToInt32(Console.ReadLine()); + 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); + } +} diff --git a/csharp-workbook.csproj b/csharp-workbook.csproj new file mode 100644 index 00000000..d06178dc --- /dev/null +++ b/csharp-workbook.csproj @@ -0,0 +1,9 @@ + + + + Exe + netcoreapp2.1 + csharp_workbook + + + diff --git a/week1-Practice/Program.cs b/week1-Practice/Program.cs new file mode 100644 index 00000000..84a82396 --- /dev/null +++ b/week1-Practice/Program.cs @@ -0,0 +1,35 @@ +using System; + +public class Program +{ + 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:"); + // ReadLine enters the string + name = Console.ReadLine(); + Console.WriteLine("Please enter your last name:"); + lastname = Console.ReadLine(); + Console.WriteLine("Please enter your age:"); + // Convert.ToInt32 takes in the numbers + age = Convert.ToInt32(Console.ReadLine()); + 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); + } +} diff --git a/week1-Practice/week1-Practice.csproj b/week1-Practice/week1-Practice.csproj new file mode 100644 index 00000000..6b3e6080 --- /dev/null +++ b/week1-Practice/week1-Practice.csproj @@ -0,0 +1,9 @@ + + + + Exe + netcoreapp2.1 + week1_Practice + + + From 6252b48b4d79a5e2748d23c92bd20c4fed840d6b Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Sun, 7 Oct 2018 11:39:47 -0500 Subject: [PATCH 02/15] week1-Practice --- .../{Program.cs => week1-Practice.cs} | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) rename week1-Practice/{Program.cs => week1-Practice.cs} (57%) diff --git a/week1-Practice/Program.cs b/week1-Practice/week1-Practice.cs similarity index 57% rename from week1-Practice/Program.cs rename to week1-Practice/week1-Practice.cs index 84a82396..4b074e1b 100644 --- a/week1-Practice/Program.cs +++ b/week1-Practice/week1-Practice.cs @@ -8,6 +8,7 @@ public static void Main() string lastname = ""; int age = 0; int year = 7; + string job = ""; string band = ""; string team = ""; @@ -20,16 +21,18 @@ public static void Main() Console.WriteLine("Please enter your age:"); // Convert.ToInt32 takes in the numbers age = Convert.ToInt32(Console.ReadLine()); - Console.WriteLine("Who is your favorite band:"); + Console.WriteLine("What is your Job?"); + job = Console.ReadLine(); + Console.WriteLine("Who is your favorite band?"); band = Console.ReadLine(); - Console.WriteLine("What sports team do you cheer for:"); + 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); + Console.WriteLine(@"Hello! My name is {0} {1}.", name, lastname); + Console.WriteLine("I am {1} in dog years.", age, year * age); + Console.WriteLine("I work as a {0}.", job); + Console.WriteLine("My favorite band is {0}.", band); + Console.WriteLine("I support {0}! ", team); } } From c89f24ec311f7e4adddd499e51cfad26a3c55d5c Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Sun, 7 Oct 2018 12:19:17 -0500 Subject: [PATCH 03/15] week1-2 --- week1-Practice/week1-Practice.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/week1-Practice/week1-Practice.cs b/week1-Practice/week1-Practice.cs index 4b074e1b..5656278a 100644 --- a/week1-Practice/week1-Practice.cs +++ b/week1-Practice/week1-Practice.cs @@ -4,6 +4,7 @@ public class Program { public static void Main() { + decimal num = 3.35m; string name = ""; string lastname = ""; int age = 0; @@ -11,8 +12,12 @@ public static void Main() string job = ""; string band = ""; string team = ""; + int hund = 100; + int ten = 10; + Console.WriteLine("The product of NUM is {0}", num * num); + Console.WriteLine("Please enter your first name:"); // ReadLine enters the string name = Console.ReadLine(); @@ -34,5 +39,11 @@ public static void Main() Console.WriteLine("I work as a {0}.", job); Console.WriteLine("My favorite band is {0}.", band); Console.WriteLine("I support {0}! ", team); + + Console.WriteLine("The Sum of 100 and 10 is {0}", hund + ten); + Console.WriteLine("The Product of 100 and 10 is {0}", hund * ten); + Console.WriteLine("The Difference of 100 and 10 is {0}", hund - ten); + Console.WriteLine("The Quotient of 100 and 10 is {0}", hund / ten); + } } From cf86de209200033fb6fe57dd9e6111dbbf232f59 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Sun, 7 Oct 2018 12:45:10 -0500 Subject: [PATCH 04/15] week1-Practice.cs --- week1-Practice/week1-Practice.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/week1-Practice/week1-Practice.cs b/week1-Practice/week1-Practice.cs index 5656278a..84f02e44 100644 --- a/week1-Practice/week1-Practice.cs +++ b/week1-Practice/week1-Practice.cs @@ -4,6 +4,10 @@ public class Program { public static void Main() { + int one = 0; + int two = 0; + int yard = 12; + int inch = 12; decimal num = 3.35m; string name = ""; string lastname = ""; @@ -16,6 +20,14 @@ public static void Main() int ten = 10; + + Console.WriteLine("Please enter a whole number:"); + one = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Please enter a whole number:"); + two = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("{0} Pluse {1} equals {2}", one, two, one + two); + + Console.WriteLine("12 yards is {0} inches", yard * inch); Console.WriteLine("The product of NUM is {0}", num * num); Console.WriteLine("Please enter your first name:"); From 0ad6f430bd9f95f148f866a01fd24d589fe4438c Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Sun, 7 Oct 2018 20:00:56 -0500 Subject: [PATCH 05/15] week1-Practice.cs --- week1-Practice/week1-Practice.cs | 55 +++++++++++++++++++------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/week1-Practice/week1-Practice.cs b/week1-Practice/week1-Practice.cs index 84f02e44..eb36eb78 100644 --- a/week1-Practice/week1-Practice.cs +++ b/week1-Practice/week1-Practice.cs @@ -4,32 +4,40 @@ public class Program { public static void Main() { + int one = 0; int two = 0; + + Console.WriteLine("Please enter a whole number:"); + one = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Please enter a whole number:"); + two = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("{0} + {1} = {2}", one, two, one + two); + int yard = 12; int inch = 12; + + Console.WriteLine("12 yards is {0} inches", yard * inch); + decimal num = 3.35m; + + Console.WriteLine("The product of NUM(3.35) is {0}", num * num); + + bool people = true; + Console.WriteLine(people); + + bool f = false; + Console.WriteLine(f); + // you told me to use f as the variable + string name = ""; string lastname = ""; int age = 0; - int year = 7; + int year = 2018; string job = ""; string band = ""; string team = ""; - int hund = 100; - int ten = 10; - - - Console.WriteLine("Please enter a whole number:"); - one = Convert.ToInt32(Console.ReadLine()); - Console.WriteLine("Please enter a whole number:"); - two = Convert.ToInt32(Console.ReadLine()); - Console.WriteLine("{0} Pluse {1} equals {2}", one, two, one + two); - - Console.WriteLine("12 yards is {0} inches", yard * inch); - Console.WriteLine("The product of NUM is {0}", num * num); - Console.WriteLine("Please enter your first name:"); // ReadLine enters the string name = Console.ReadLine(); @@ -46,16 +54,19 @@ public static void Main() team = Console.ReadLine(); - Console.WriteLine(@"Hello! My name is {0} {1}.", name, lastname); - Console.WriteLine("I am {1} in dog years.", age, year * age); + Console.WriteLine(@"Hello! My name is {0} {1}.", name, lastname); + Console.WriteLine("I was born in {1}.", age, year - age); Console.WriteLine("I work as a {0}.", job); - Console.WriteLine("My favorite band is {0}.", band); - Console.WriteLine("I support {0}! ", team); + Console.WriteLine("My favorite band is {0}.", band); + Console.WriteLine("I support {0}! ", team); + + int hund = 100; + int ten = 10; - Console.WriteLine("The Sum of 100 and 10 is {0}", hund + ten); - Console.WriteLine("The Product of 100 and 10 is {0}", hund * ten); - Console.WriteLine("The Difference of 100 and 10 is {0}", hund - ten); - Console.WriteLine("The Quotient of 100 and 10 is {0}", hund / ten); + Console.WriteLine("The Sum of 100 and 10 = {0}", hund + ten); + Console.WriteLine("The Product of 100 and 10 = {0}", hund * ten); + Console.WriteLine("The Difference of 100 and 10 = {0}", hund - ten); + Console.WriteLine("The Quotient of 100 and 10 = {0}", hund / ten); } } From 2b057f5816b0594a897ed1652bd9a6490a37772a Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 8 Oct 2018 07:46:33 -0500 Subject: [PATCH 06/15] week1-Practice.cs --- TextGame/TextGame.cs | 12 ++++++++++++ TextGame/TextGame.csproj | 8 ++++++++ week1-Practice/week1-Practice.cs | 1 + 3 files changed, 21 insertions(+) create mode 100644 TextGame/TextGame.cs create mode 100644 TextGame/TextGame.csproj diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs new file mode 100644 index 00000000..db251101 --- /dev/null +++ b/TextGame/TextGame.cs @@ -0,0 +1,12 @@ +using System; + +namespace TextGame +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} 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 + + + diff --git a/week1-Practice/week1-Practice.cs b/week1-Practice/week1-Practice.cs index eb36eb78..d244ab1c 100644 --- a/week1-Practice/week1-Practice.cs +++ b/week1-Practice/week1-Practice.cs @@ -34,6 +34,7 @@ public static void Main() string lastname = ""; int age = 0; int year = 2018; + // adjust to current year string job = ""; string band = ""; string team = ""; From 2bc9d335f327af60fd14ba21119b652a0d01fb91 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 8 Oct 2018 07:49:17 -0500 Subject: [PATCH 07/15] week1-Practice.cs --- week1-Practice/week1-Practice.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/week1-Practice/week1-Practice.cs b/week1-Practice/week1-Practice.cs index d244ab1c..4f0ea126 100644 --- a/week1-Practice/week1-Practice.cs +++ b/week1-Practice/week1-Practice.cs @@ -20,6 +20,7 @@ public static void Main() Console.WriteLine("12 yards is {0} inches", yard * inch); decimal num = 3.35m; + // m suffix used with decimal Console.WriteLine("The product of NUM(3.35) is {0}", num * num); From ab0b1fb83ede47d61756059be87ea8cdd938300f Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 8 Oct 2018 08:05:05 -0500 Subject: [PATCH 08/15] TextGame.cs --- TextGame/TextGame.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index db251101..025b01e0 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -1,4 +1,5 @@ using System; +using System.Threading; namespace TextGame { @@ -6,7 +7,16 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Console.WriteLine("Welcome to the cavern of secrets!"); + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + + Thread.Sleep(3000); + //time pause method in C#(millsec) + + 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."); + + } } } From 12a3d6212ccb7c1d59a128cef6bd62cbf81eb895 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 8 Oct 2018 14:56:06 -0500 Subject: [PATCH 09/15] TextGame.cs --- TextGame/TextGame.cs | 70 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 025b01e0..d08d9689 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -7,16 +7,74 @@ class Program { static void Main(string[] args) { - Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - Console.WriteLine("Welcome to the cavern of secrets!"); - Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - Thread.Sleep(3000); - //time pause method in C#(millsec) + int stick = 0; - 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Console.WriteLine("Welcome to the cavern of secrets!"); + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Thread.Sleep(3000); + //time pause method in C#(millsec) + 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 ch1 = Console.ReadLine(); + + if (ch1 == "Y" || ch1 == "y" || ch1 == "Yes" || ch1 == "YES" || ch1 == "yes") + { + Console.WriteLine("You have taken the stick"); + Thread.Sleep(2000); + 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 ch2 = Console.ReadLine(); + + 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(1); + Console.WriteLine("The eye belongs to a giant spider!"); + } + + Console.WriteLine("Do you try to fight it? [Y/N]"); + + String ch3 = Console.ReadLine(); + + if (ch3 == "Y" || ch3 == "y" || ch3 == "Yes" || ch3 == "YES" || ch3 == "yes") + { + 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"); + 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Thread.Sleep(2000); + + Random rnd = new Random(); + int fdmg1 = rnd.Next(3, 10); + int edmg1 = rnd.Next(1, 5); + + Console.WriteLine("you hit a {0}", fdmg1); + Console.WriteLine("the spider hits a {0}", edmg1); + Thread.Sleep(2000); + //generates random ints in the range entered after .Next + + } } } } From 50f07d90f6f6c50960297438fd06466f290a5541 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 8 Oct 2018 15:43:33 -0500 Subject: [PATCH 10/15] TextGame.cs --- TextGame/TextGame.cs | 61 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index d08d9689..85b74ace 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -74,6 +74,67 @@ static void Main(string[] args) Thread.Sleep(2000); //generates random ints in the range entered after .Next + int complete = 0; + + if (edmg1 > fdmg1) + { + Console.WriteLine("The spider has dealt more damage than you!"); + complete = 0; + return; + } + else if (fdmg1 < 5) + { + Console.WriteLine("You didn't do enough damage to kill the spider, but you manage to escape"); + complete = 1; + return; + } + else + { + Console.WriteLine("You killed the spider!"); + complete = 1; + return; + } + } + + 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Thread.Sleep(2000); + + Random rnd = new Random(); + int fdmg1 = rnd.Next(1, 8); + int edmg1 = rnd.Next(1, 5); + + Console.WriteLine("you hit a", fdmg1); + Console.WriteLine("the spider hits a", edmg1); + Thread.Sleep(2000); + + int complete = 0; + + if (edmg1 > fdmg1) + { + Console.WriteLine("The spider has dealt more damage than you!"); + complete = 0; + return; + } + else if (fdmg1 < 5) + { + Console.WriteLine("You didn't do enough damage to kill the spider, but you manage to escape"); + complete = 1; + return; + } + else + { + Console.WriteLine("You killed the spider!"); + complete = 1; + return; + } } } } From 6b7129ca133ecc30c7d6d5fa19488d13123e5a86 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 8 Oct 2018 16:06:49 -0500 Subject: [PATCH 11/15] TextGame.cs --- TextGame/TextGame.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 85b74ace..544dbb7e 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -111,8 +111,8 @@ static void Main(string[] args) int fdmg1 = rnd.Next(1, 8); int edmg1 = rnd.Next(1, 5); - Console.WriteLine("you hit a", fdmg1); - Console.WriteLine("the spider hits a", edmg1); + Console.WriteLine("you hit a {0}", fdmg1); + Console.WriteLine("the spider hits a {0}", edmg1); Thread.Sleep(2000); int complete = 0; @@ -135,6 +135,12 @@ static void Main(string[] args) complete = 1; return; } + + 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!!!"); + //complete = 0; + return; } } } From 3625bd860b5d3d1dfdda32295f006de0b1de4cc4 Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 8 Oct 2018 18:16:22 -0500 Subject: [PATCH 12/15] TextGame.cs --- TextGame/TextGame.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 544dbb7e..0ee3f18b 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -55,7 +55,7 @@ static void Main(string[] args) if (ch3 == "Y" || ch3 == "y" || ch3 == "Yes" || ch3 == "YES" || ch3 == "yes") { if (stick == 1) - Console.WriteLine("You only have a stick to fight with!"); + 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"); Thread.Sleep(2000); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); @@ -99,6 +99,7 @@ static void Main(string[] args) else { Console.WriteLine("You don't have anything to fight with!"); + Console.WriteLine("You quickly jab it with your finger"); Thread.Sleep(2000); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Console.WriteLine(" Fighting... "); @@ -135,12 +136,13 @@ static void Main(string[] args) complete = 1; return; } - - 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!!!"); - //complete = 0; - return; + + + 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!!!"); + //complete = 0; + return; } } } From 20f8f8b50737ecaf5e2dcc922039fac34870099d Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 8 Oct 2018 20:53:18 -0500 Subject: [PATCH 13/15] TextGame.cs --- TextGame/TextGame.cs | 186 +++++++++++++++++++++++-------------------- 1 file changed, 98 insertions(+), 88 deletions(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 0ee3f18b..94bd13bd 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -46,103 +46,113 @@ static void Main(string[] args) Console.WriteLine("As you draw closer, you begin to make out the object as an eye!"); Thread.Sleep(1); Console.WriteLine("The eye belongs to a giant spider!"); - } - - Console.WriteLine("Do you try to fight it? [Y/N]"); - - String ch3 = Console.ReadLine(); - - if (ch3 == "Y" || ch3 == "y" || ch3 == "Yes" || ch3 == "YES" || ch3 == "yes") - { - 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"); - 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - Thread.Sleep(2000); - - Random rnd = new Random(); - int fdmg1 = rnd.Next(3, 10); - int edmg1 = rnd.Next(1, 5); - - Console.WriteLine("you hit a {0}", fdmg1); - Console.WriteLine("the spider hits a {0}", edmg1); - Thread.Sleep(2000); - //generates random ints in the range entered after .Next - - int complete = 0; - - if (edmg1 > fdmg1) - { - Console.WriteLine("The spider has dealt more damage than you!"); - complete = 0; - return; - } - else if (fdmg1 < 5) - { - Console.WriteLine("You didn't do enough damage to kill the spider, but you manage to escape"); - complete = 1; - return; - } - else - { - Console.WriteLine("You killed the spider!"); - complete = 1; - return; - } - } - - else - { - Console.WriteLine("You don't have anything to fight with!"); - Console.WriteLine("You quickly jab it with your finger"); - 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - Thread.Sleep(2000); + - Random rnd = new Random(); - int fdmg1 = rnd.Next(1, 8); - int edmg1 = rnd.Next(1, 5); + Console.WriteLine("Do you try to fight it? [Y/N]"); - Console.WriteLine("you hit a {0}", fdmg1); - Console.WriteLine("the spider hits a {0}", edmg1); - Thread.Sleep(2000); + String ch3 = Console.ReadLine(); - int complete = 0; - - if (edmg1 > fdmg1) - { - Console.WriteLine("The spider has dealt more damage than you!"); - complete = 0; - return; - } - else if (fdmg1 < 5) + if (ch3 == "Y" || ch3 == "y" || ch3 == "Yes" || ch3 == "YES" || ch3 == "yes") { - Console.WriteLine("You didn't do enough damage to kill the spider, but you manage to escape"); - complete = 1; - return; - } - else - { - Console.WriteLine("You killed the spider!"); - complete = 1; - return; - } - - + 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"); + 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Thread.Sleep(2000); + + Random rnd = new Random(); + int fdmg1 = rnd.Next(3, 10); + int edmg1 = rnd.Next(1, 5); + + Console.WriteLine("you hit a {0}", fdmg1); + Console.WriteLine("the spider hits a {0}", edmg1); + Thread.Sleep(2000); + //generates random ints in the range entered after .Next + + int complete = 0; + + if (edmg1 > fdmg1) + { + Console.WriteLine("The spider has dealt more damage than you!"); + complete = 0; + return; + } + else if (fdmg1 < 5) + { + Console.WriteLine("You didn't do enough damage to kill the spider, but you manage to escape"); + complete = 1; + return; + } + else + { + Console.WriteLine("You killed the spider!"); + complete = 1; + return; + } + } + + else + { + Console.WriteLine("You don't have anything to fight with!"); + Console.WriteLine("You quickly jab it with your finger"); + 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Thread.Sleep(2000); + + Random rnd = new Random(); + int fdmg1 = rnd.Next(1, 8); + int edmg1 = rnd.Next(1, 5); + + Console.WriteLine("you hit a {0}", fdmg1); + Console.WriteLine("the spider hits a {0}", edmg1); + Thread.Sleep(2000); + + int complete = 0; + + if (edmg1 > fdmg1) + { + Console.WriteLine("The spider has dealt more damage than you!"); + complete = 0; + return; + } + else if (fdmg1 < 5) + { + Console.WriteLine("You didn't do enough damage to kill the spider, but you manage to escape"); + complete = 1; + return; + } + else + { + Console.WriteLine("You killed the spider!"); + complete = 1; + return; + } + } + } 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!!!"); //complete = 0; return; + + } + 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...."); + Thread.Sleep(2000); + return; + } } } From 52de1d2dc4a0bf68be502051b780acfa262583cc Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Mon, 8 Oct 2018 20:57:17 -0500 Subject: [PATCH 14/15] TextGame.cs --- TextGame/TextGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 94bd13bd..3770af7b 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -141,7 +141,6 @@ static void Main(string[] args) 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!!!"); - //complete = 0; return; } @@ -157,3 +156,4 @@ static void Main(string[] args) } } } +// be extremely mindful of indentation/formatting!!! \ No newline at end of file From 8744e62acf1ff8495755825b2751017292b7591f Mon Sep 17 00:00:00 2001 From: Jason Connolly Date: Wed, 10 Oct 2018 18:19:29 -0500 Subject: [PATCH 15/15] TextGame.cs --- TextGame/TextGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs index 3770af7b..5f454a22 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/TextGame.cs @@ -156,4 +156,4 @@ static void Main(string[] args) } } } -// be extremely mindful of indentation/formatting!!! \ No newline at end of file +// be extremely mindful of indentation/formatting/alignment!!! \ No newline at end of file