Untitled

mail@pastecode.io avatar
unknown
csharp
11 days ago
9.2 kB
1
Indexable
Never
using System;
using System.Threading;
using System.Collections.Generic;

public class Program
{
    public static void Main(string[] args)
    {
        Display display = new Display();
        Input input = new Input();
        Game game = new Game();
        List<int> sequence = new List<int>();
        display.displayStartMenu();
        Console.Clear();
        Console.WriteLine("test");
    }
}

public class Display
{
    public void displayStartMenu()
    {
        Console.Clear();
        Console.WriteLine("   _____ _                       ");
        Console.WriteLine("  / ____(_)                      ");
        Console.WriteLine(" | (___  _ _ __ ___   ___  _ __  ");
        Console.WriteLine("  \\___ \\| | '_ ` _ \\ / _ \\| '_ \\ ");
        Console.WriteLine("  ____) | | | | | | | (_) | | | |");
        Console.WriteLine(" |_____/|_|_| |_| |_|\\___/|_| |_|");
        Console.WriteLine(" ____________________________________");
        Console.WriteLine("/_____/_____/_____/_____/_____/_____/");
        Console.WriteLine("");
        Console.WriteLine("  1. Play Simon");
        Console.WriteLine("  2. How to Play");
        Console.WriteLine("  3. Exit");
    }
    public void displaySimon()
    {
        Console.Clear();
        Console.WriteLine("   _____ _                       ");
        Console.WriteLine("  / ____(_)                      ");
        Console.WriteLine(" | (___  _ _ __ ___   ___  _ __  ");
        Console.WriteLine("  \\___ \\| | '_ ` _ \\ / _ \\| '_ \\ ");
        Console.WriteLine("  ____) | | | | | | | (_) | | | |");
        Console.WriteLine(" |_____/|_|_| |_| |_|\\___/|_| |_|");
        Console.WriteLine(" ____________________________________");
        Console.WriteLine("/_____/_____/_____/_____/_____/_____/\n");
        Console.WriteLine("         ┌───┐");
        Console.WriteLine("         │ w │");
        Console.WriteLine("         └───┘");
        Console.WriteLine("    ┌───┐     ┌───┐");
        Console.WriteLine("    │ a │     │ d │");
        Console.WriteLine("    └───┘     └───┘");
        Console.WriteLine("         ┌───┐");
        Console.WriteLine("         │ s │");
        Console.WriteLine("         └───┘");
    }
    public void displayHowTo()
    {
        Console.Clear();
        Console.WriteLine("In Simon, the objective is simply to repeat an increasingly long sequence\n" +
            "of lights and sounds. The game starts by lighting up one of four colored\n" +
            "buttons (red, green, blue, yellow). The player must press the lit button.\n" +
            "The game then adds another random button to the sequence, and the player\n" +
            "must repeat the entire sequence in order. If the player is correct, the sequence\n" +
            "length increases; if incorrect, the game ends. For example, in Round 1, the game shows\n" +
            "Red, and the player presses Red. In Round 2, the game shows Red, Blue, and the\n" +
            "player presses Red, Blue. Focus on recognizing patterns, and with practice, memory improves.");
        Console.WriteLine("\nPress any key...");
        Console.ReadKey();
    }

    public void highlightUp()
    {
        Console.Clear();
        Console.WriteLine("   _____ _                       ");
        Console.WriteLine("  / ____(_)                      ");
        Console.WriteLine(" | (___  _ _ __ ___   ___  _ __  ");
        Console.WriteLine("  \\___ \\| | '_ ` _ \\ / _ \\| '_ \\ ");
        Console.WriteLine("  ____) | | | | | | | (_) | | | |");
        Console.WriteLine(" |_____/|_|_| |_| |_|\\___/|_| |_|");
        Console.WriteLine(" ____________________________________");
        Console.WriteLine("/_____/_____/_____/_____/_____/_____/\n");
        Console.WriteLine("         ╔═══╗");
        Console.WriteLine("         ║ w ║");
        Console.WriteLine("         ╚═══╝");
        Console.WriteLine("    ┌───┐     ┌───┐");
        Console.WriteLine("    │ a │     │ d │");
        Console.WriteLine("    └───┘     └───┘");
        Console.WriteLine("         ┌───┐");
        Console.WriteLine("         │ s │");
        Console.WriteLine("         └───┘");
    }
    public void highlightDown()
    {
        Console.Clear();
        Console.WriteLine("   _____ _                       ");
        Console.WriteLine("  / ____(_)                      ");
        Console.WriteLine(" | (___  _ _ __ ___   ___  _ __  ");
        Console.WriteLine("  \\___ \\| | '_ ` _ \\ / _ \\| '_ \\ ");
        Console.WriteLine("  ____) | | | | | | | (_) | | | |");
        Console.WriteLine(" |_____/|_|_| |_| |_|\\___/|_| |_|");
        Console.WriteLine(" ____________________________________");
        Console.WriteLine("/_____/_____/_____/_____/_____/_____/\n");
        Console.WriteLine("         ┌───┐");
        Console.WriteLine("         │ w │");
        Console.WriteLine("         └───┘");
        Console.WriteLine("    ┌───┐     ┌───┐");
        Console.WriteLine("    │ a │     │ d │");
        Console.WriteLine("    └───┘     └───┘");
        Console.WriteLine("         ╔═══╗");
        Console.WriteLine("         ║ s ║");
        Console.WriteLine("         ╚═══╝");
    }
    public void highlightLeft()
    {
        Console.Clear();
        Console.WriteLine("   _____ _                       ");
        Console.WriteLine("  / ____(_)                      ");
        Console.WriteLine(" | (___  _ _ __ ___   ___  _ __  ");
        Console.WriteLine("  \\___ \\| | '_ ` _ \\ / _ \\| '_ \\ ");
        Console.WriteLine("  ____) | | | | | | | (_) | | | |");
        Console.WriteLine(" |_____/|_|_| |_| |_|\\___/|_| |_|");
        Console.WriteLine(" ____________________________________");
        Console.WriteLine("/_____/_____/_____/_____/_____/_____/\n");
        Console.WriteLine("         ┌───┐");
        Console.WriteLine("         │ w │");
        Console.WriteLine("         └───┘");
        Console.WriteLine("    ╔═══╗     ┌───┐");
        Console.WriteLine("    ║ a ║     │ d │");
        Console.WriteLine("    ╚═══╝     └───┘");
        Console.WriteLine("         ┌───┐");
        Console.WriteLine("         │ s │");
        Console.WriteLine("         └───┘");
    }
    public void highlightRight()
    {
        Console.Clear();
        Console.WriteLine("   _____ _                       ");
        Console.WriteLine("  / ____(_)                      ");
        Console.WriteLine(" | (___  _ _ __ ___   ___  _ __  ");
        Console.WriteLine("  \\___ \\| | '_ ` _ \\ / _ \\| '_ \\ ");
        Console.WriteLine("  ____) | | | | | | | (_) | | | |");
        Console.WriteLine(" |_____/|_|_| |_| |_|\\___/|_| |_|");
        Console.WriteLine(" ____________________________________");
        Console.WriteLine("/_____/_____/_____/_____/_____/_____/\n");
        Console.WriteLine("         ┌───┐");
        Console.WriteLine("         │ w │");
        Console.WriteLine("         └───┘");
        Console.WriteLine("    ┌───┐     ╔═══╗");
        Console.WriteLine("    │ a │     ║ d ║");
        Console.WriteLine("    └───┘     ╚═══╝");
        Console.WriteLine("         ┌───┐");
        Console.WriteLine("         │ s │");
        Console.WriteLine("         └───┘");

    }
}

public class Input
{
    Display display = new Display();
}

/* public class Test
{
    Display display = new Display();
    public void displayTest()
    {
        display.highlightUp();
        Thread.Sleep(300);
        display.highlightRight();
        Thread.Sleep(300);
        display.highlightDown();
        Thread.Sleep(300);
        display.highlightLeft();
        Thread.Sleep(300);
    }
} */

public class Game
{
    static Random random = new Random();
    Display display = new Display();
    Input input = new Input();

    public void startMenu()
    {
        bool validChoice = false;

        while (validChoice == false)
        {
            display.displayStartMenu();
            string menuOption = Console.ReadLine();
            Console.WriteLine(menuOption);

            if (menuOption == "1")
            {
                validChoice = true;
                // play simon              
            }
            else if (menuOption == "2")
            {
                validChoice = true;
                display.displayHowTo();
                
            }
            else if (menuOption == "3")
            {
                Environment.Exit(0);
            }
            else
            {
                Console.WriteLine("Press a valid key!");
                Thread.Sleep(300);
            }
        }
    }

    public void sequenceAppendRandom(List<int> sequence)
    {
        int randomNumber = random.Next(0, 3);
        sequence.Add(randomNumber);
    }
}
Leave a Comment