Skip to content

Ruupertti's CodeCache #1 - C# [EN] Mystery Cache

Hidden : 7/3/2018
Difficulty:
4 out of 5
Terrain:
3.5 out of 5

Size: Size:   small (small)

Join now to view geocache location details. It's free!

Watch

How Geocaching Works

Please note Use of geocaching.com services is subject to the terms and conditions in our disclaimer.

Geocache Description:


Some helpful information


To solve this mystery you're going to need some basic programming skills. The particular language used in these bits of code is C#, but the logic functions similarly across most OOP languages.

Even if you don't know any programming, google can be a helpful tool, if you know which key words to use. If you struggle to find solutions or can't wrap your head around a concept, refer to the official documentation of C#.

Enough guidance, let us begin!


The owner of this mystery has some calculations which generate the coordinates for a particular plastic box's location. The calculations only requires six numbers to produce the correct coordinates. Unfortunately, the owner forgot those numbers!
Damn programmers and their damn memories!

Facepalm

Well, at least there are some eager plastic box hunters who might be able to help the owner..
Are you one of them?

If so, you're in luck. The owner has backups of some challenges that may help you with finding the numbers!

Each challenge is a multiple choice question with one correct answer each, except the final challenge.
After each answer there is a segment that looks like this: ' = x' where x is the number you're supposed to write down.

When you think you've got the correct answer, write it down to a piece of paper.
(Nerd alternative: use notepad!)

First challenge!


Question 1: How many times does this function print "Loop completed" to console?


public Challenge1()
        {
            for (int i = 0; i < 10; i++)
            {
                if (i == 3)
                {
                    continue;
                }
                if (i == 7)
                {
                    break;
                }

                Console.WriteLine("Loop completed");
            }
        }

Answers for question 1:

A: 0 times = 65
B: 6 times = 58
C: 10 times = 54
D: 7 times = 49

First challenge!


0..1..2... Oh! Wait, programmer's counting.. This is challenge number two!


Question 2: What does this function print to the console?


public Challenge2()
        {
            int MAX_NUMBER = 16;

            int number = 0;

            for (int i = 0; i < 5; i++)
            {
                number = Add(number, i + 2);

                if (number > MAX_NUMBER)
                {
                    return;
                    Console.WriteLine("Loop failed!");
                }
                if (number == MAX_NUMBER)
                {
                    break;
                }
                if (number > 7 && number < 10)
                {
                    number = Substract(number, i);
                    continue;
                }
                number = Add(number, 1);
            }

            if (number <= MAX_NUMBER)
            {
                Console.WriteLine(number);
            }
        }

        private int Add(int input, int amount)
        {
            return input + amount;
        }
        private int Substract(int input, int amount)
        {
            return input - amount;
        }

Answers for question 2:
(Pick only one!)

Output is a number:
 A: Number is 18 = 2
 B: Number is 17 = 20
 C: Number is 12 = 23

Output is something else:
 D: Output is "Loop failed!" = 12
 E: Output is "Loop failed!" twice = 8
 F: The function has no output = 3

Challenge 3!


Question 3: Which values, separated by commas, does this function print?


public Challenge3()
        {
            int[] array = new int[] { 10 };
            int[] array2 = new int[10];

            foreach (var number in array)
            {
                Console.WriteLine(number);
            }

            foreach (var number in array2)
            {
                Console.WriteLine(number);
            }
        }

Answers for question 3:
(Pick only one!)

Function prints valid output:
 A: 10,0,0,0,0,0,0,0,0,0,0 = 6
 B: 0,0,0,0,0,0,0,0,0,0,10 = 9
 C: 10 = 28
 D: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 = 23

Function doesn't print valid output:
 E: 'array' is not initialized = 24
 F: 'array2' is not initialized = 5
 G: 'array' has invalid values = 39
 H: 'array2' has invalid values = 95

Challenge number FOUR!


Question 4: What is the length of the string this function prints?

Question 5: If '#' is present in the string, what is it's index?


public Challenge4()
        {
            string name = "CodeCache#1";

            StringBuilder output = new StringBuilder();

            output.Append(name[9]);
            output.Append(name.Substring(4, 5));
            output.Append(name.Substring(0, 4) + "r");

            Console.WriteLine(output.ToString());
        }

Answers for questions 4 & 5:

Question 4 answers:

 A: 11 characters = 4
 B: 6 characters = 1200
 C: 9 characters = 16
 D: 13 characters = 53

Question 5 answers:

 A: Index is 1 = 200
 B: Index is 4 = 400
 C: Index is 0 = 1200
 D: Index is -1 = 6600
 E: '#' is not present in the string = 903

FIIINAAALLLL ROOUUUUNNNDDDDD!


The answer for this question is the first four numbers of the output of this function, IGNORING THE DECIMAL POINT.


public FinalChallenge()
        {
            Car car = new Car
            {
                Engine_HorsePower = 141,
                Vehicle_Weight = 1300
            };

            Truck truck = new Truck
            {
                Engine_HorsePower = 340,
                Vehicle_Weight = 19000,
                Load_Weight = 9000
            };

            Truck lightTruck = new Truck
            {
                Engine_HorsePower = 300,
                Vehicle_Weight = 16000,
                Load_Weight = 5000
            };

            Bus bus = new Bus
            {
                Engine_HorsePower = 145,
                Vehicle_Weight = 11000,
                Passengers_Total_Weight = 600
            };

            Bus emptyBus = new Bus
            {
                Engine_HorsePower = 145,
                Vehicle_Weight = 11000,
                Passengers_Total_Weight = 0
            };

            car.SetPowerToWeightRatio();
            truck.SetPowerToWeightRatio();
            lightTruck.SetPowerToWeightRatio();
            bus.SetPowerToWeightRatio();
            emptyBus.SetPowerToWeightRatio();

           Console.WriteLine((car.PowerToWeightRatio + truck.PowerToWeightRatio + lightTruck.PowerToWeightRatio
                + bus.PowerToWeightRatio + emptyBus.PowerToWeightRatio) / 5);
 
        }

        class Vehicle
        {
            public double Engine_HorsePower { get; set; }
            public double Vehicle_Weight { get; set; }
            public double PowerToWeightRatio { get; set; }

            public virtual void SetPowerToWeightRatio()
            {
                PowerToWeightRatio = Engine_HorsePower / (Vehicle_Weight / 1000);
            }
        }

        class Car : Vehicle { }

        class Truck : Vehicle
        {
            public double Load_Weight { get; set; }

            public override void SetPowerToWeightRatio()
            {
                PowerToWeightRatio =  Engine_HorsePower / ((Vehicle_Weight + Load_Weight) / 1000);
            }
        }

        class Bus : Vehicle
        {
            public double Passengers_Total_Weight { get; set; }

            public override void SetPowerToWeightRatio()
            {
                PowerToWeightRatio = Engine_HorsePower / ((Vehicle_Weight + Passengers_Total_Weight) / 1000);
            }
        }

Done tinkering yet?


Now all you need to do is to calculate the final coordinates using the numbers you've just obtained.
Seeing as you've done your part of the tinkering, the owner of this mystery has the calculations already set up, just for you.

You're welcome!

The calculation for NORTH coordinates is:

answer1 * answer4 * answer3 * FinalAnswer + 1833034

The calculation for EAST coordinates is:

answer2 * answer3 * (answer5 / 2) * FinalAnswer / 10 - 1321267

Once you have calculated these numbers, you should format them to match this format: XX XX.XXX.

Note: if the result is NOT 7 digits long or you get an impossible number as a result, one (or more) of your answers is incorrect.

Once formatted, you can check the coordinates you've got with the geochecker below.

If you don't get it right, go back and make sure you've written down the correct answer, have the right amount of digits on the final answer and that you've used the calculations exactly as they're written.



Help! I'm not nerdy enough for this!


If this mystery is proving a challenge to you, please read the first paragraph of this description. If you've tried your best, googled, cried a little or maybe are just completely lost, don't hesitate to message the owner of this mystery for assistance. (You can message me both in English, tai suomeksi!)


Congratulations, you've found an easter egg!

Here, have a cookie.

Additional Hints (Decrypt)

Gur pnpur vf snveyl qrrc haqre n ebpx, qba'g jrne lbhe orfg pybgurf!

Decryption Key

A|B|C|D|E|F|G|H|I|J|K|L|M
-------------------------
N|O|P|Q|R|S|T|U|V|W|X|Y|Z

(letter above equals below, and vice versa)