From badc33d6d01d05af4b99c822e4175881560487f1 Mon Sep 17 00:00:00 2001 From: steinti100434 <wurcax-xuvvo7-dadwAk> Date: Sun, 1 Dec 2024 21:37:50 +0100 Subject: [PATCH] Added Classes for single and multiplayer Renamed Class Program.cs --- Check.cs | 17 ++++++ MastermindController.cs | 8 ++- Multiplayer.cs | 12 ++++ Singleplayer.cs | 12 ++++ Program.cs => StartMenu.cs | 110 ++++++++++++++++++------------------- Tutorial.cs | 4 +- 6 files changed, 104 insertions(+), 59 deletions(-) create mode 100644 Check.cs create mode 100644 Multiplayer.cs create mode 100644 Singleplayer.cs rename Program.cs => StartMenu.cs (97%) diff --git a/Check.cs b/Check.cs new file mode 100644 index 0000000..51a4bf0 --- /dev/null +++ b/Check.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mastermind +{ + internal class Check + { + public void CheckGame(int[] input) + { + + + } + } +} diff --git a/MastermindController.cs b/MastermindController.cs index bd69f2e..f8ae25b 100644 --- a/MastermindController.cs +++ b/MastermindController.cs @@ -21,6 +21,10 @@ namespace Controller Console.WriteLine("Welcome to Mastermind!"); Console.WriteLine("======================"); + Console.WriteLine("Please select a Gamemode:\n"); + Console.WriteLine("[S]ingle Player\n"); + Console.WriteLine("[M]ultiplayer\n"); + // User selects a difficulty Console.WriteLine("Please select the difficulty you would like to play on:\n"); @@ -47,7 +51,7 @@ namespace Controller checkMenu = true; break; case "r": - Program.MainMenu(); + StartMenu.MainMenu(); return; default: Console.WriteLine("Something went wrong! Try again. Only the letters \"E\", \"M\", \"H\". \"R\" are allowed. "); @@ -111,7 +115,7 @@ namespace Controller Console.WriteLine("Returning to main menu"); checkMenu = true; Console.Clear(); - Program.MainMenu(); + StartMenu.MainMenu(); return; default: Console.WriteLine("Something went wrong! Try again! Only the letters \"Y\" and \"N\" are allowed."); diff --git a/Multiplayer.cs b/Multiplayer.cs new file mode 100644 index 0000000..5e23927 --- /dev/null +++ b/Multiplayer.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mastermind +{ + internal class Multiplayer + { + } +} diff --git a/Singleplayer.cs b/Singleplayer.cs new file mode 100644 index 0000000..9fa3534 --- /dev/null +++ b/Singleplayer.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mastermind +{ + internal class Singleplayer + { + } +} diff --git a/Program.cs b/StartMenu.cs similarity index 97% rename from Program.cs rename to StartMenu.cs index fdaefca..dd26647 100644 --- a/Program.cs +++ b/StartMenu.cs @@ -1,56 +1,56 @@ -using System; -using Controller; - -namespace Mastermind -{ - class Program - { - static void Main() - { - { - MainMenu(); - while (true) - { - string? input = Console.ReadLine(); //string? allows for null-value - if (input != null) //"filter out" null values to avoid crash - { - switch (input.ToLower()) - { - case "s": - Console.WriteLine("Starting Game ..."); - MastermindController controller = new(); - controller.Play(); - break; - case "t": - MasterMindTutorial.Tutorial(); - break; - case "q": - return; - default: - Console.WriteLine("Please pick a valid Option."); - break; - } - } - else - { - Console.WriteLine("Please pick a valid Option."); - } - } - } - } - public static void MainMenu() - { - Console.WriteLine("\n███╗ ███╗ █████╗ ███████╗████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗██████╗"); - Console.WriteLine("████╗ ████║██╔â•â•â–ˆâ–ˆâ•—██╔â•â•â•â•â•â•šâ•â•â–ˆâ–ˆâ•”â•â•â•â–ˆâ–ˆâ•”â•â•â•â•â•â–ˆâ–ˆâ•”â•â•â–ˆâ–ˆâ•—████╗ ████║██║████╗ ██║██╔â•â•â–ˆâ–ˆâ•—"); - Console.WriteLine("██╔████╔██║███████║███████╗ ██║ █████╗ ██████╔â•â–ˆâ–ˆâ•”████╔██║██║██╔██╗ ██║██║ ██║"); - Console.WriteLine("██║╚██╔â•â–ˆâ–ˆâ•‘██╔â•â•â–ˆâ–ˆâ•‘â•šâ•â•â•â•â–ˆâ–ˆâ•‘ ██║ ██╔â•â•â• ██╔â•â•â–ˆâ–ˆâ•—██║╚██╔â•â–ˆâ–ˆâ•‘██║██║╚██╗██║██║ ██║"); - Console.WriteLine("██║ â•šâ•â• ██║██║ ██║███████║ ██║ ███████╗██║ ██║██║ â•šâ•â• ██║██║██║ ╚████║██████╔â•"); - Console.WriteLine("â•šâ•â• â•šâ•â•â•šâ•â• â•šâ•â•â•šâ•â•â•â•â•â•â• â•šâ•â• â•šâ•â•â•â•â•â•â•â•šâ•â• â•šâ•â•â•šâ•â• â•šâ•â•â•šâ•â•â•šâ•â• â•šâ•â•â•â•â•šâ•â•â•â•â•â•"); - Console.WriteLine("\nPlease Choose:"); - Console.WriteLine("[S]tart Game"); - Console.WriteLine("[T]utorial"); - Console.WriteLine("[Q]uit"); - } - - } +using System; +using Controller; + +namespace Mastermind +{ + class StartMenu + { + static void Main() + { + { + MainMenu(); + while (true) + { + string? input = Console.ReadLine(); //string? allows for null-value + if (input != null) //"filter out" null values to avoid crash + { + switch (input.ToLower()) + { + case "s": + Console.WriteLine("Starting Game ..."); + MastermindController controller = new(); + controller.Play(); + break; + case "t": + MasterMindTutorial.Tutorial(); + break; + case "q": + return; + default: + Console.WriteLine("Please pick a valid Option."); + break; + } + } + else + { + Console.WriteLine("Please pick a valid Option."); + } + } + } + } + public static void MainMenu() + { + Console.WriteLine("\n███╗ ███╗ █████╗ ███████╗████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗██████╗"); + Console.WriteLine("████╗ ████║██╔â•â•â–ˆâ–ˆâ•—██╔â•â•â•â•â•â•šâ•â•â–ˆâ–ˆâ•”â•â•â•â–ˆâ–ˆâ•”â•â•â•â•â•â–ˆâ–ˆâ•”â•â•â–ˆâ–ˆâ•—████╗ ████║██║████╗ ██║██╔â•â•â–ˆâ–ˆâ•—"); + Console.WriteLine("██╔████╔██║███████║███████╗ ██║ █████╗ ██████╔â•â–ˆâ–ˆâ•”████╔██║██║██╔██╗ ██║██║ ██║"); + Console.WriteLine("██║╚██╔â•â–ˆâ–ˆâ•‘██╔â•â•â–ˆâ–ˆâ•‘â•šâ•â•â•â•â–ˆâ–ˆâ•‘ ██║ ██╔â•â•â• ██╔â•â•â–ˆâ–ˆâ•—██║╚██╔â•â–ˆâ–ˆâ•‘██║██║╚██╗██║██║ ██║"); + Console.WriteLine("██║ â•šâ•â• ██║██║ ██║███████║ ██║ ███████╗██║ ██║██║ â•šâ•â• ██║██║██║ ╚████║██████╔â•"); + Console.WriteLine("â•šâ•â• â•šâ•â•â•šâ•â• â•šâ•â•â•šâ•â•â•â•â•â•â• â•šâ•â• â•šâ•â•â•â•â•â•â•â•šâ•â• â•šâ•â•â•šâ•â• â•šâ•â•â•šâ•â•â•šâ•â• â•šâ•â•â•â•â•šâ•â•â•â•â•â•"); + Console.WriteLine("\nPlease Choose:"); + Console.WriteLine("[S]tart Game"); + Console.WriteLine("[T]utorial"); + Console.WriteLine("[Q]uit"); + } + + } } \ No newline at end of file diff --git a/Tutorial.cs b/Tutorial.cs index 6b76fd2..d34e2fc 100644 --- a/Tutorial.cs +++ b/Tutorial.cs @@ -35,11 +35,11 @@ namespace Mastermind Console.WriteLine("In this Tutorial Game you will have unlimited tries. Also the Code won't change."); TutorialGame(); Console.Clear(); - Program.MainMenu(); + StartMenu.MainMenu(); return; case "b": Console.Clear(); - Program.MainMenu(); + StartMenu.MainMenu(); return; default: Console.WriteLine("Please pick a valid Option."); -- GitLab