diff --git a/HelloWorld/HelloWorld.cs b/HelloWorld/HelloWorld.cs index 8168c805..ad2bd0d7 100644 --- a/HelloWorld/HelloWorld.cs +++ b/HelloWorld/HelloWorld.cs @@ -6,7 +6,21 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + string name = ""; + string ccn = ""; + int exp = 0; + int cvv = 0; + + Console.WriteLine("Please enter your full name as written on your credit card: "); + name = Console.ReadLine(); + Console.WriteLine("Please enter your full credit card number, with no spaces or dashes: "); + ccn = Console.ReadLine(); + Console.WriteLine("Please enter the expiration date of your card as a 6 digit number with no spaces: "); + exp = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Please enter the 3-digit CVV number on the back of your card: "); + cvv = Convert.ToInt32(Console.ReadLine()); + + Console.WriteLine("Hello! My name is {0} and I'm a sucker. My credit card number is {1}. The expiration date is {2} and the CVV number is {3}.", name, ccn, exp, cvv); } } } diff --git a/Program.cs b/Program.cs new file mode 100644 index 00000000..d879ba8f --- /dev/null +++ b/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace csharp_workbook +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} 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/day2practice/HelloWorld.cs b/day2practice/HelloWorld.cs new file mode 100644 index 00000000..68cdcc3c --- /dev/null +++ b/day2practice/HelloWorld.cs @@ -0,0 +1,77 @@ +using System; + +namespace HelloWorld +{ + class Program + { + static void Main(string[] args) + { + + // add 2 numbers, convert to int + // int x = 0; + // int y = 0; + + // Console.WriteLine("give number"); + // x = Convert.ToInt32(Console.ReadLine()); + + // Console.WriteLine("give 2nd number"); + // y = Convert.ToInt32(Console.ReadLine()); + + // Console.WriteLine("{0} + {1} = {2}", x, y, x+y); + + + + + // converts yards to inches + // int yard = 12; + // int query = 0; + + // Console.WriteLine("How many yards?"); + // query = Convert.ToInt32(Console.ReadLine()); + // Console.WriteLine("{0} yards is {1} inches", query, yard*query); + + + + //bool people = true; + //bool f = false; + + // decimal num = 0.23M; + // Console.WriteLine(num); + + + + // string firstName = null; + // string lastName = null; + // var age = 0; + // string job = null; + // string favoriteBand = null; + // string favoriteVideoGame = null; + + // Console.WriteLine("Whats your first name?"); + // firstName = Console.ReadLine(); + // Console.WriteLine("Whats your last name?"); + // lastName = Console.ReadLine(); + // Console.WriteLine("Whats your age?"); + // age = Convert.ToInt32(Console.ReadLine()); + // Console.WriteLine("Whats your job"); + // job = Console.ReadLine(); + // Console.WriteLine("Whats your favorite band?"); + // favoriteBand = Console.ReadLine(); + // Console.WriteLine("Whats your favorite video game?"); + // favoriteVideoGame = Console.ReadLine(); + + // Console.WriteLine( + // "Your name is {0} {1}. You are {2} years old. You are a {3} for a living. {4} is your favorite band, even though it should be Guided By Voices. {5} is your favorite game.", + // firstName, lastName, age, job, favoriteBand, favoriteVideoGame); + + + + + + + + + + } + } +} diff --git a/day2practice/HelloWorld.csproj b/day2practice/HelloWorld.csproj new file mode 100644 index 00000000..ce1697ae --- /dev/null +++ b/day2practice/HelloWorld.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.0 + + + diff --git a/practice2/.vscode/launch.json b/practice2/.vscode/launch.json new file mode 100644 index 00000000..23303620 --- /dev/null +++ b/practice2/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/practice2.dll", + "args": [], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window + "console": "internalConsole", + "stopAtEntry": false, + "internalConsoleOptions": "openOnSessionStart" + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ,] +} \ No newline at end of file diff --git a/practice2/.vscode/tasks.json b/practice2/.vscode/tasks.json new file mode 100644 index 00000000..44bc3e38 --- /dev/null +++ b/practice2/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/practice2.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/practice2/Program.cs b/practice2/Program.cs new file mode 100644 index 00000000..3a5d9eaf --- /dev/null +++ b/practice2/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace practice2 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/practice2/practice2.csproj b/practice2/practice2.csproj new file mode 100644 index 00000000..23df6047 --- /dev/null +++ b/practice2/practice2.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/textGame/textGame.cs b/textGame/textGame.cs new file mode 100644 index 00000000..fb08feab --- /dev/null +++ b/textGame/textGame.cs @@ -0,0 +1,202 @@ +using System; + +namespace textGame +{ + class Program + { + static void Main(string[] args) + { + + PlayGame(); + + void PlayGame() + { + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Console.WriteLine("Welcome to the cavern of secrets!"); + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + System.Threading.Thread.Sleep(1000); + 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."); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("Do you take it? [y/n]: "); + + int complete = 0; + int stick = 0; + + string ch1 = Console.ReadLine(); + + if (ch1 == "y") + { + stick = 1; + Console.WriteLine("You have taken the stick!"); + System.Threading.Thread.Sleep(1000); + } + else + { + stick = 0; + Console.WriteLine("You did not take the stick"); + System.Threading.Thread.Sleep(1000); + } + + Console.WriteLine("As you proceed further into the cave, you see a small glowing object"); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("Do you approach the object? [y/n]"); + + string ch2 = Console.ReadLine(); + + if (ch2 == "y") + { + Console.WriteLine("You approach the object..."); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("As you draw closer, you begin to make out the object as an eye!"); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("The eye belongs to a giant spider!"); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("Do you try to fight it? [y/n]"); + string ch3 = Console.ReadLine(); + + if (ch3 == "y") + { + if (stick == 1) + { + //WITH STICK + Console.WriteLine("You only have a stick to fight with!"); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("You quickly jab the spider in it's eye and gain an advantage"); + System.Threading.Thread.Sleep(1000); + 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + System.Threading.Thread.Sleep(1000); + + Random rnd = new Random(); + int fdmg1 = rnd.Next(3, 10); + int edmg1 = rnd.Next(1, 5); + + Console.WriteLine("you hit a " + fdmg1); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("the spider hits a " + edmg1); + System.Threading.Thread.Sleep(1000); + + if (edmg1 > fdmg1) + { + Console.WriteLine("The spider has dealt more damage than you!"); + System.Threading.Thread.Sleep(1000); + complete = 0; + CheckStatus(); + } + else if (fdmg1 < 5) + { + Console.WriteLine("You didn't do enough damage to kill the spider, but you manage to escape"); + System.Threading.Thread.Sleep(1000); + complete = 1; + CheckStatus(); + } + else + { + Console.WriteLine("You killed the spider!"); + System.Threading.Thread.Sleep(1000); + complete = 1; + CheckStatus(); + } + } + else + { + //WITHOUT STICK + Console.WriteLine("You don't have anything to fight with!"); + System.Threading.Thread.Sleep(1000); + 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("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + System.Threading.Thread.Sleep(1000); + + Random rnd = new Random(); + int fdmg1 = rnd.Next(1, 8); + int edmg1 = rnd.Next(1, 5); + + Console.WriteLine("you hit a " + fdmg1); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("the spider hits a " + edmg1); + System.Threading.Thread.Sleep(1000); + + if (edmg1 > fdmg1) + { + Console.WriteLine("The spider has dealt more damage than you!"); + System.Threading.Thread.Sleep(1000); + complete = 0; + CheckStatus(); + } + else if (fdmg1 < 5) + { + Console.WriteLine("You didn't do enough damage to kill the spider, but you manage to escape"); + System.Threading.Thread.Sleep(1000); + complete = 1; + CheckStatus(); + } + else + { + Console.WriteLine("You killed the spider!"); + System.Threading.Thread.Sleep(1000); + complete = 1; + CheckStatus(); + } + } + } + else + { + //DON'T FIGHT SPIDER + Console.WriteLine("You choose not to fight the spider."); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("As you turn away, it ambushes you and impales you with it's fangs!!!"); + System.Threading.Thread.Sleep(1000); + complete = 0; + CheckStatus(); + } + } + else + { + //DONT MOVE TOWARDS LIGHT + stick = 0; + Console.WriteLine("You turn away from the glowing object, and attempt to leave the cave..."); + System.Threading.Thread.Sleep(1000); + Console.WriteLine("But something won't let you...."); + System.Threading.Thread.Sleep(1000); + PlayGame(); + } + + void CheckStatus() + { + if (complete == 1) + { + Console.WriteLine("You managed to escape the cavern alive! Would you like to play again? [y/n]: "); + string replay = Console.ReadLine(); + if (replay == "y") + { + PlayGame(); + } + else + { + Console.WriteLine("GAME OVER"); + } + } + else + { + Console.WriteLine("You have died! Would you like to play again? [y/n]: "); + string replay = Console.ReadLine(); + if (replay == "y") + { + PlayGame(); + } + else + { + Console.WriteLine("GAME OVER"); + } + } + } + } + } + } +} 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 + + +