Ejemplo n.º 1
0
 public void EndPuzzle(string puzzleName)
 {
     if (puzzleName.Equals("Puzzle1"))
     {
         Puzzle1 p = gameObject.GetComponent <Puzzle1>();
         if (p.IsActive())
         {
             p.End();
         }
     }
     if (puzzleName.Equals("Puzzle2"))
     {
         Puzzle2 p = gameObject.GetComponent <Puzzle2>();
         if (p.IsActive())
         {
             p.End();
         }
     }
     if (puzzleName.Equals("Puzzle3"))
     {
         Puzzle3 p = gameObject.GetComponent <Puzzle3>();
         if (p.IsActive())
         {
             p.End();
         }
     }
 }
Ejemplo n.º 2
0
 public void StartPuzzle(string puzzleName)
 {
     if (puzzleName.Equals("Puzzle1"))
     {
         Puzzle1 p = gameObject.GetComponent <Puzzle1>();
         if (!p.IsActive())
         {
             p.Begin();
         }
     }
     else if (puzzleName.Equals("Puzzle2"))
     {
         Puzzle2 p = gameObject.GetComponent <Puzzle2>();
         if (!p.IsActive())
         {
             p.Begin();
         }
     }
     else if (puzzleName.Equals("Puzzle3"))
     {
         Puzzle3 p = gameObject.GetComponent <Puzzle3>();
         if (!p.IsActive())
         {
             p.Begin();
         }
     }
 }
Ejemplo n.º 3
0
    void Start()
    {
        instance = this;

        theDM     = DialogueManager.instance;
        thePlayer = PlayerManager.instance;
        theDB     = DatabaseManager.instance;
        thePuzzle = PuzzleManager.instance;
        theGame   = GameManager.instance;

        thePlayer.isPlayingPuzzle = true;
        thePlayer.notMove         = true;



        // if(theDB.gameOverList.Contains(7))
        //     cactus.SetActive(false);
        // if(theDB.gameOverList.Contains(8)){
        //     cactusUsed.SetActive(true);
        // }
        // if(theDB.gameOverList.Contains(9)){
        //     boxClosed.SetActive(false);
        //     cactusUsed.SetActive(false);
        //     boxOpened.SetActive(true);
        //     handle.SetActive(true);
        // }
        // if(theDB.gameOverList.Contains(10)){
        //     handle.SetActive(false);
        // }
        // if(theDB.gameOverList.Contains(11)){
        //     handleUsed.SetActive(true);
        // }
        // // if(theDB.gameOverList.Contains(12)){
        // //     drawer0Closed.SetActive(false);
        // //     handleUsed.SetActive(false);
        // //     drawer0Opened.SetActive(true);
        // //     key.SetActive(true);
        // // }
        // if(theDB.gameOverList.Contains(13)){
        //     key.SetActive(false);
        //     canExit = true;
        // }
        // // if(theDB.gameOverList.Contains(14)){
        // //     drawer1Closed.SetActive(false);
        // //     drawer1Opened.SetActive(true);
        // //     matches.SetActive(true);
        // // }
        // if(theDB.gameOverList.Contains(15)){
        //     matches.SetActive(false);
        // }
        // if(theDB.gameOverList.Contains(16)){
        //     fire.gameObject.SetActive(true);
        //     num5.gameObject.SetActive(true);
        // }
    }
Ejemplo n.º 4
0
    private void Start()
    {
        changeCamera = ChangeCamera.Instance;
        interactTxt.SetActive(false);
        backTxt.SetActive(false);
        winTxt.SetActive(false);

        puzzle1 = Puzzle1.Instance;
        puzzle2 = Puzzle2.Instance;
        puzzle3 = Puzzle3.Instance;
        puzzle4 = Puzzle4.Instance;
    }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            IPuzzle       p;
            List <string> input = new();

            int puzzleNumber = int.Parse(args[0]);

            switch (puzzleNumber)
            {
            case 1:
                p = new Puzzle1();
                break;

            case 2:
                p = new Puzzle2();
                break;

            case 3:
                p = new Puzzle3();
                break;

            case 4:
                p = new Puzzle4();
                break;

            default:
                throw new ArgumentException("Invalid puzzle number");
            }

            Console.WriteLine("Paste puzzle input now, with a blank line to finish:");

            string consoleInput;

            while (true)
            {
                consoleInput = Console.ReadLine();
                if (string.IsNullOrEmpty(consoleInput))
                {
                    break;
                }

                input.Add(consoleInput);
            }

            p.Input(input);
            Console.WriteLine($"Puzzle solved: {p.Run()}");
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Which puzzle would you like to run?");
            string puzzle = Console.ReadLine();

            switch (puzzle)
            {
            case "1":
                Puzzle1.Run();
                break;

            case "2a":
                Puzzle2.Run(1);
                break;

            case "2b":
                Puzzle2.Run(2);
                break;

            case "3a":
                Puzzle3.Run(1);
                break;

            case "4a":
                Puzzle4.Run(1);
                break;

            case "4b":
                Puzzle4.Run(2);
                break;

            case "5a":
                Puzzle5.Run(1);
                break;

            case "5b":
                Puzzle5.Run(2);
                break;

            default:
                Console.WriteLine("Puzzle not found");
                break;
            }
        }
Ejemplo n.º 7
0
    private void OnTriggerEnter(Collider other)
    {
        GameObject blue    = GameObject.Find("Blue");
        Puzzle3    puzzle3 = blue.GetComponent <Puzzle3>();
        GameObject green   = GameObject.Find("Green");
        Puzzle2    puzzle2 = green.GetComponent <Puzzle2>();

        if (triggered == 1)
        {
            if (red == 1 && puzzle3.blue == 1 && puzzle2.green == 1 && puzzle3.blue2 == 1)
            {
                red2 = 1;
            }
            else
            {
                puzzle2.green     = 0;
                red               = 0;
                puzzle3.blue      = 0;
                puzzle3.blue2     = 0;
                red2              = 0;
                triggered         = 0;
                puzzle3.triggered = 0;
            }
        }
        if (triggered == 0)
        {
            if (puzzle2.green == 0 && puzzle3.blue == 0)
            {
                red       = 1;
                triggered = 1;
            }
            else
            {
                puzzle2.green     = 0;
                red               = 0;
                puzzle3.blue      = 0;
                puzzle3.blue2     = 0;
                red2              = 0;
                triggered         = 0;
                puzzle3.triggered = 0;
            }
        }
    }
Ejemplo n.º 8
0
    private void OnTriggerEnter(Collider other)
    {
        GameObject red     = GameObject.Find("Red");
        Puzzle1    puzzle1 = red.GetComponent <Puzzle1>();
        GameObject green   = GameObject.Find("Green");
        Puzzle2    puzzle2 = green.GetComponent <Puzzle2>();

        if (triggered == 1)
        {
            if (puzzle1.red == 1 && puzzle2.green == 1 && blue == 1)
            {
                blue2 = 1;
            }
            else
            {
                puzzle1.red       = 0;
                puzzle2.green     = 0;
                puzzle1.red2      = 0;
                blue              = 0;
                blue2             = 0;
                triggered         = 1;
                puzzle1.triggered = 0;
            }
        }
        if (triggered == 0)
        {
            if (puzzle1.red == 1)
            {
                blue      = 1;
                triggered = 1;
            }
            else
            {
                puzzle1.red       = 0;
                puzzle2.green     = 0;
                puzzle1.red2      = 0;
                blue              = 0;
                blue2             = 0;
                triggered         = 1;
                puzzle1.triggered = 0;
            }
        }
    }
Ejemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        GameObject red     = GameObject.Find("Red");
        Puzzle1    puzzle1 = red.GetComponent <Puzzle1>();
        GameObject green   = GameObject.Find("Green");
        Puzzle2    puzzle2 = green.GetComponent <Puzzle2>();
        GameObject blue    = GameObject.Find("Blue");
        Puzzle3    puzzle3 = blue.GetComponent <Puzzle3>();

        if (puzzle1.red == 1 && puzzle3.blue == 1 && puzzle2.green == 1 && puzzle3.blue2 == 1 && puzzle1.red2 == 1)
        {
            door.SetActive(false);
            if (!audioS.isPlaying)
            {
                audioS.clip = doorOpen;
                audioS.Play();
            }
        }
    }
Ejemplo n.º 10
0
        private static void StartPuzzle(int puzzle)
        {
            switch (puzzle)
            {
            case 1:
                Console.WriteLine("Puzzle 1 solutions");
                Console.WriteLine("Part 1 sum is: " + Puzzle1.SolvePart1(PuzzleResources.Puzzle1));
                Console.WriteLine("Part 2 sum is: " + Puzzle1.SolvePart2(PuzzleResources.Puzzle1));
                break;

            case 2:
                Console.WriteLine("Puzzle 2 solutions");
                Console.WriteLine("Part 1 sum is: " + Puzzle2.SolvePart1(PuzzleResources.Puzzle2));
                Console.WriteLine("Part 2 sum is: " + Puzzle2.SolvePart2(PuzzleResources.Puzzle2));
                break;

            case 3:
                Console.WriteLine("Puzzle 3 solutions");
                Console.WriteLine("Part 1 sum is: " + Puzzle3.SolvePart1(PuzzleResources.Puzzle3));
                Console.WriteLine("Part 2 sum is: " + Puzzle3.SolvePart2(PuzzleResources.Puzzle3));
                break;

            case 4:
                Console.WriteLine("Puzzle 4 solutions");
                Console.WriteLine("Part 1 count is: " + Puzzle4.SolvePart1());
                Console.WriteLine("Part 2 count is: " + Puzzle4.SolvePart2());
                break;

            case 5:
                Console.WriteLine("Puzzle 5 solutions");
                Console.WriteLine("Part 1 stepcount is: " + Puzzle5.SolvePart1(PuzzleResources.Puzzle5));
                Console.WriteLine("Part 2 stepcount is: " + Puzzle5.SolvePart2(PuzzleResources.Puzzle5));
                break;

            case 6:
                Console.WriteLine("Puzzle 6 solutions");
                Console.WriteLine("Part 1 stepcount is: " + Puzzle6.SolveParts(PuzzleResources.Puzzle6, false));
                Console.WriteLine("Part 2 stepcount is: " + Puzzle6.SolveParts(PuzzleResources.Puzzle6, true));
                break;

            case 7:
                Console.WriteLine("Puzzle 7 solutions");
                Console.WriteLine("Part 1 stepcount is: " + Puzzle7.Solve1());
                Console.WriteLine("Part 2 stepcount is: " + Puzzle7.Solve2());
                break;

            case 8:
                Console.WriteLine("Puzzle 8 solutions");
                Console.WriteLine("Part 1 max value is: " + Puzzle8.Solve(false));
                Console.WriteLine("Part 2 max value is: " + Puzzle8.Solve(true));
                break;

            case 9:
                Console.WriteLine("Puzzle 9 solutions");
                Console.WriteLine("Part 1 groupcount is: " + Puzzle9.Solve(PuzzleResources.Puzzle9, false));
                Console.WriteLine("Part 2 count is: " + Puzzle9.Solve(PuzzleResources.Puzzle9, true));
                break;

            case 10:
                Console.WriteLine("Puzzle 10 solutions");
                Console.WriteLine("Part 1 multiply result is: " + Puzzle10.Solve(PuzzleResources.Puzzle10, 256, false));
                Console.WriteLine("Part 2 count is: " + Puzzle10.Solve(PuzzleResources.Puzzle10, 256, true));
                break;

            case 11:
                Console.WriteLine("Puzzle 11 solutions");
                Console.WriteLine("Part 1 steps is: " + Puzzle11.Solve(PuzzleResources.Puzzle11, false));
                Console.WriteLine("Part 2 max steps is: " + Puzzle11.Solve(PuzzleResources.Puzzle11, true));
                break;

            case 12:
                Console.WriteLine("Puzzle 12 solutions");
                Console.WriteLine("Part 1 count is: " + Puzzle12.Solve(new List <int>()
                {
                    0
                }, false));
                Console.WriteLine("Part 1 count is: " + Puzzle12.Solve(new List <int>()
                {
                    0
                }, false));
                break;

            case 13:
                Console.WriteLine("Puzzle 13 solutions");
                Console.WriteLine("Part 1 severity is: " + Puzzle13.Solve1(PuzzleResources.Puzzle13));
                Console.WriteLine("Part 1 required delay is: " + Puzzle13.Solve2(PuzzleResources.Puzzle13));
                break;
            }
        }
Ejemplo n.º 11
0
        private static void PlayPuzzle()
        {
            Console.WriteLine("Which puzzle do you want to play?");
            var input = Console.ReadLine();

            Console.ForegroundColor = ConsoleColor.Cyan;;
            switch (input)
            {
            case "1":
                var input1 = File.ReadAllText("Inputs/Puzzle01.txt");
                Console.WriteLine($"Puzzle 1A answer is {Puzzle1.Part1(input1)}");
                Console.WriteLine($"Puzzle 1B answer is {Puzzle1.Part2(input1)}");
                break;

            case "2":
                var input2 = File.ReadAllLines("Inputs/Puzzle02.txt");
                Console.WriteLine($"Puzzle 2A answer is {Puzzle2.Part1(input2)}");
                Console.WriteLine($"Puzzle 2B answer is {Puzzle2.Part2(input2)}");
                break;

            case "3":
                var input3 = 325489;
                Console.WriteLine($"Puzzle 3A answer is {Puzzle3.Part1(input3)}");
                Console.WriteLine($"Puzzle 3B answer is {Puzzle3.Part2(input3)}");
                break;

            case "4":
                var input4 = File.ReadAllLines("Inputs/Puzzle04.txt");
                Console.WriteLine($"Puzzle 4A answer is {Puzzle4.Part1(input4)}");
                Console.WriteLine($"Puzzle 4B answer is {Puzzle4.Part2(input4)}");
                break;

            case "5":
                var input5 = File.ReadAllLines("Inputs/Puzzle05.txt");
                Console.WriteLine($"Puzzle 4A answer is {Puzzle5.Part1(input5)}");
                Console.WriteLine($"Puzzle 4B answer is {Puzzle5.Part2(input5)}");
                break;

            case "6":
                var input6 = File.ReadAllText("Inputs/Puzzle06.txt");
                Console.WriteLine($"Puzzle 6A answer is {Puzzle6.Part1(input6)}");
                Console.WriteLine($"Puzzle 6B answer is {Puzzle6.Part2(input6)}");
                break;

            case "7":
                var input7 = File.ReadAllLines("Inputs/Puzzle07.txt");
                Console.WriteLine($"Puzzle 7A answer is {Puzzle7.Part1(input7)}");
                Console.WriteLine($"Puzzle 7B answer is {Puzzle7.Part2(input7)}");
                break;

            case "8":
                var input8 = File.ReadAllLines("Inputs/Puzzle08.txt");
                Console.WriteLine($"Puzzle 8A answer is {Puzzle8.Part1(input8)}");
                Console.WriteLine($"Puzzle 8B answer is {Puzzle8.Part2(input8)}");
                break;

            case "9":
                var input9 = File.ReadAllText("Inputs/Puzzle09.txt");
                Console.WriteLine($"Puzzle 9A answer is {Puzzle9.Part1(input9)}");
                Console.WriteLine($"Puzzle 9B answer is {Puzzle9.Part2(input9)}");
                break;

            case "10":
                var input10 = File.ReadAllText("Inputs/Puzzle10.txt");
                Console.WriteLine($"Puzzle 10A answer is {Puzzle10.Part1(input10)}");
                Console.WriteLine($"Puzzle 10B answer is {Puzzle10.Part2(input10)}");
                break;

            case "11":
                var input11 = File.ReadAllText("Inputs/Puzzle11.txt");
                Console.WriteLine($"Puzzle 11A answer is {Puzzle11.Part1(input11)}");
                Console.WriteLine($"Puzzle 11B answer is {Puzzle11.Part2(input11)}");
                break;

            case "12":
                var input12 = File.ReadAllLines("Inputs/Puzzle12.txt");
                Console.WriteLine($"Puzzle 12A answer is {Puzzle12.Part1(input12)}");
                Console.WriteLine($"Puzzle 12B answer is {Puzzle12.Part2(input12)}");
                break;

            case "13":
                var input13 = File.ReadAllLines("Inputs/Puzzle13.txt");
                Console.WriteLine($"Puzzle 13A answer is {Puzzle13.Part1(input13)}");
                Console.WriteLine($"Puzzle 13B answer is {Puzzle13.Part2(input13)}");
                break;

            case "14":
                var input14 = File.ReadAllText("Inputs/Puzzle14.txt");
                Console.WriteLine($"Puzzle 14A answer is {Puzzle14.Part1(input14)}");
                Console.WriteLine($"Puzzle 14B answer is {Puzzle14.Part2(input14)}");
                break;

            case "15":
                var input15 = File.ReadAllLines("Inputs/Puzzle15.txt");
                Console.WriteLine($"Puzzle 15A answer is {Puzzle15.Part1(input15)}");
                Console.WriteLine($"Puzzle 15B answer is {Puzzle15.Part2(input15)}");
                break;

            case "16":
                var input16 = File.ReadAllText("Inputs/Puzzle16.txt");
                Console.WriteLine($"Puzzle 16A answer is {Puzzle16.Part1(input16)}");
                Console.WriteLine($"Puzzle 16B answer is {Puzzle16.Part2(input16)}");
                break;

            case "17":
                var input17 = File.ReadAllText("Inputs/Puzzle17.txt");
                Console.WriteLine($"Puzzle 17A answer is {Puzzle17.Part1(input17)}");
                Console.WriteLine($"Puzzle 17B answer is {Puzzle17.Part2(input17)}");
                break;

            case "18":
                var input18 = File.ReadAllLines("Inputs/Puzzle18.txt");
                Console.WriteLine($"Puzzle 18A answer is {Puzzle18.Part1(input18)}");
                Console.WriteLine($"Puzzle 18B answer is {Puzzle18.Part2(input18)}");
                break;

            case "19":
                var input19 = File.ReadAllLines("Inputs/Puzzle19.txt");
                Console.WriteLine($"Puzzle 19A answer is {Puzzle19.Part1(input19)}");
                Console.WriteLine($"Puzzle 19B answer is {Puzzle19.Part2(input19)}");
                break;

            case "20":
                var input20 = File.ReadAllLines("Inputs/Puzzle20.txt");
                Console.WriteLine($"Puzzle 20A answer is {Puzzle20.Part1(input20)}");
                Console.WriteLine($"Puzzle 20B answer is {Puzzle20.Part2(input20)}");
                break;

            case "21":
                var input21 = File.ReadAllLines("Inputs/Puzzle21.txt");
                Console.WriteLine($"Puzzle 21A answer is {Puzzle21.Part1(input21)}");
                Console.WriteLine($"Puzzle 21B answer is {Puzzle21.Part2(input21)}");
                break;

            case "22":
                var input22 = File.ReadAllLines("Inputs/Puzzle22.txt");
                Console.WriteLine($"Puzzle 22A answer is {Puzzle22.Part1(input22)}");
                Console.WriteLine($"Puzzle 22B answer is {Puzzle22.Part2(input22)}");
                break;

            case "23":
                var input23 = File.ReadAllLines("Inputs/Puzzle23.txt");
                Console.WriteLine($"Puzzle 23A answer is {Puzzle23.Part1(input23)}");
                Console.WriteLine($"Puzzle 23B answer is {Puzzle23.Part2(input23)}");
                break;

            case "24":
                var input24 = File.ReadAllLines("Inputs/Puzzle24.txt");
                Console.WriteLine($"Puzzle 24A answer is {Puzzle24.Part1(input24)}");
                Console.WriteLine($"Puzzle 24B answer is {Puzzle24.Part2(input24)}");
                break;

            case "25":
                Console.WriteLine($"Puzzle 25A answer is {Puzzle25.Part1()}");
                break;

            default:
                throw new NotImplementedException("That puzzle is not available yet");
            }
            Console.ForegroundColor = ConsoleColor.White;
        }
Ejemplo n.º 12
0
 void Start()
 {
     anim = GetComponent <Animator>();
     p    = Puzzle2.Instance;
 }