# Thread: Contest Results - Snake Numbers

1. ## Contest Results - Snake Numbers

I had a bit more free time on my hands than I anticipated, so I was able to get all the results together a bit quicker than I thought.

This is the first contest I've ever run, so this was a bit of a learning experience for me. The first thing I learned: be extremely specific in the requirements.

Here's a few fun questions: Suppose you have a two-dimensional integer array, array.
1. Do you index the array with indices x and y like array[x][y] or array[y][x]?
2. From any particular (x,y), how do you move 'north' from that position?

These are some rather important questions that I didn't answer, and every entry assumed something different. After smacking myself in the head a few times, I #ifdef'ed up the test program to account for these differences and went to testing.

So...congratulations to Cactus_Hugger! Cactus_Hugger's entry ran fast and generated some good moves. If you want to see the full results and the entries, click here.

One question: when do you want another?

2. First thanks for running the contest and it was fun.
One question: when do you want another?
I'd like another as soon as possible

Third, I could had had comparable times to Cactus, but I decided to try to get a higher score, which I did...but at a price.

Finally regarding the use of statics
Coding Style
The code was organized and fairly simple to understand. I liked the two offset arrays. In SnakeNumbers(int[18][18], std::vector&, int), the use of static variables means that you can't call the function twice in the same program. There were also a few "magic numbers" that could have been constants.
My function was actually called recursively, and the static was so that any call of the function could know, what the "best" values were so that it could decide to give up or allow the recursion to go deeper. However this wouldn't be safe in a multi-threaded environment. The only way around it was to make it a class, which seemed a bit overkill for such a simple problem.

3. I have an idea for another one that would pit each entry against the others in an AI match. How does that sound?

4. I won...

The time saved me. I have a 450Mhz PC, so I didn't like sitting around all day. And gains became minimal. And it seems we all had much the same solution: brute force. I seem to have the only non-recursive one. Will look more later... tis late now.

Looking at the compilation part... interesting what happens when two compilers look over the same code. I'm a MinGW user. The first warning is totally deserved - Print doesn't do what it says. (Nor what I intended... it was supposed to use s... my bad. It was entirely a debug function though. Talk about some big text files...) Your comments are right, though I haven't figured out the last two warnings.

Your next contest sounds interesting. Hopefully there'll be more entries. Thanks for this contest!

5. I'll enter the next contest too, this time I'll do more testing and turn compiler warnings on

Thanx for the contest I'm looking foreward to the next one.