My solution to the first Colossal Cue Adventure puzzle

I’m not a big fan of programming puzzles. They seem to be less about solving a puzzle and more about finding the exact trick the puzzle writer wants you to find. I love Project Euler for programming challenges because you aren’t trying to outwit the puzzle writer, you’re trying to outwit yourself.

A link to Colossal Cue Adventure showed up on HN the other day. It’s a text game (like Zork) where you’re presented with a series of puzzles to solve by programming (or by hand if you’re crazy). The first one took me over an hour (closer to two probably) of basically guessing at what the puzzle writer wanted me to do before finally stumbling across the solution. I was kind of irritated while I was trying to solve it, but in hindsight I was over-thinking the whole thing. There are a lot of numbers it throws at you in the context of the game, and only a few are important.

EDIT: I don’t mean to seem so critical of the puzzles. Certainly someone more experienced in programming or better at math found them to be much more intuitive. Sometimes you just get naturally irked at something you have to fight so hard! The puzzles are really quite well presented. Kudos to Cue for making something so compelling that even a puzzle hater had to try it.

Don’t read on if you want to try the puzzle yourself.

The first puzzle presents a roulette wheel that’s special because it’s “VAX MTH%RANDOM % 36″ roulette wheel. Other clues in the game basically state that you have to replicate how the VAX random number generator works, and finding the solution seems to have to do with taking %36 of the result of the generator. The number sequence 6, 19, 16 shows up in a few places, too.

VAX’s MTH%RANDOM is a linear congruential generator that has a specific multiplier (the value for ‘a’ in the formula the link brings you to) of 69069. You pick a starting seed to feed to the formula, and the result is the next seed to feed to the formula. This provides a sequence that’s supposed to seem random.

My first guess was that you’re supposed to find the starting seed that provides a series of results that if you take those results %36 you get 6, 19, and 16. I was sort of on the right track, but because of the way I wrote the test program I never figured it out. The test program output this…

Initial Seed: N, first result % 36 = X, second result % 36 = y, third result % 36 = Z

…and I wrote tests to see if X, Y, and Z were 6, 19, and 16. I didn’t do anything silly like send %36 of the resulting seed back to the generator. This avenue might have discovered the results if I had been paying attention to the output. What you’re really supposed to do is start with the seed being 6. The result %36 is 19, and the next result %36 is 16. Ok, so there is a familiar number sequence. The next result %36 is 29, which you give back to the game (you place a bet on 29).

29 was correct, but you’re supposed to place two bets one after the other. What really threw me for a loop is that the game gives you more numbers (the numbers the ball temporarily lands on) before landing on 29. I started the number generator over again to find the next bet I’m supposed to place with those numbers, but nothing came of it. After much banging away I (completely on a whim) went back to the original sequence and played the number that came after 29, which was the correct answer.

So it was a “find the next two numbers in the sequence” puzzle wrapped up in a lot of confusing misinformation.

Here’s my small program that lists the first ten numbers in the sequence:


#include <stdio.h>
#include <math.h>

int VAXrand(unsigned int seed)
{
    unsigned int s = ((69069 * seed + 1) % (unsigned int)pow(2,32));
    return s;
}

int main()
{
    unsigned int tempseed = 0; //starting seed
    unsigned int res = 0; //store result
    unsigned int n = 0;

    tempseed = 6;
for (n = 0; n < 10; n++)
    {
        res = VAXrand(tempseed);
        printf("Starting seed: %u, seed mod 36: %u, result: %u, result mod 36: %u\n",                  tempseed, tempseed%36, res, res%36);
        tempseed = res;
    }

return 0;
}

There are two more puzzles in the game. I might tackle the next one next weekend.

This entry was posted in Programming. Bookmark the permalink.

2 Responses to My solution to the first Colossal Cue Adventure puzzle

  1. Thanks!

    I pasted the second puzzle into a code editor and tried to untangle it. In the end I “solved” it through guessing supported bruteforce.

    The third one left me clueless for now.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s