Code Puzzles

GetObscured

This is a forum game I thought of from stumbling upon IOCCC. The objective is to to make a script’s GetObscured method return something resembling the word “Obscured”. The challenge is that you can only modify the contents of a method, function, or property called Vulnerable.

Solver rules:

  • Code is solved when the GetObscured method of the script returns a form of the word “Obscured”
  • Only the contents between the brackets of the Vulnerable method may be modified

Puzzle rules:

  • The puzzle must have at least 1 method, function, or property called Vulnerable
  • Puzzle must have no more than 512 characters excluding whitespace
  • There must be an easily accessible method called GetObscured that returns a string. If this method returns something resembling “Obscured”, the puzzle is solved.
  • There has to be a solution!

Universal rules:

  • Code must be able to be compiled and run in the current version of Unity (5.2)
  • Code must be in C# or JavaScript
  • To prevent security risks, no contents of any namespace except System and System.Reflection may be used.

Here’s an example:

public struct s{
    public static string GetObscured () {
        char[] l = new char[8];
        new s(new s(), l);
        string r = "";
        foreach (char c in l) r += c;
        return r;
    }
    int i;
    static d f = (o) => {while(Vulnerable(o) >= 8) o.i -= 8; return Vulnerable(o);};
    delegate int d (s o);
    public s(s o, char[] l) {
        i = o.i;
        o.i = (o.i + 5) % 8;
        l[f(this)] = o.i == 0 ? '0' :
            o.i == 1 ? 'B' :
                o.i == 2 ? '5' :
                o.i == 3 ? 'C' :
                o.i == 4 ? 'U' :
                o.i == 5 ? 'R' :
                o.i == 6 ? '3' :
                o.i == 7 ? 'D' :
                'N'
                ;
        if (i == 3) return;
        this = new s(o,l);
    }
    static int Vulnerable (s o) {
        return o.i + 43110;
    }
}

When run like this, the GetObscured() returns “D0B5CUR3”.

After solving the puzzle…

static int Vulnerable (s o) {
    return o.i + 5;
}

0B5CUR3D!

Good luck and happy brain throbbing!

Hm, I guess nobody likes code puzzles :c

You already posted the solution, there was no puzzle!

You’re supposed to come up with one!

I don’t get the point. What’s the exercise supposed to teach us?

It teaches you how to write the messiest, most unmanageable code you can think of!

I already do that every day.

5 Likes

< … i try to stay away from maths me no so good wit de maths duurr

i like the idea of code puzzles … err. wait maybe not lol
but this just sucks lol