C Board  

Go Back   C Board > Community Boards > Contests Board

Reply
 
LinkBack Thread Tools Display Modes
Old 06-20-2006, 09:51 AM   #1
Anti-Poster
 
Join Date: Feb 2002
Posts: 1,241
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?
__________________
Rule #1: Every rule has exceptions
pianorain is offline   Reply With Quote
Old 06-20-2006, 02:05 PM   #2
Tropical Coder
 
Darryl's Avatar
 
Join Date: Mar 2005
Location: Cayman Islands
Posts: 503
First thanks for running the contest and it was fun.
Quote:
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
Quote:
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.
__________________
SWinC - Simple Windows Class

Last edited by Darryl; 06-20-2006 at 02:15 PM.
Darryl is offline   Reply With Quote
Old 06-20-2006, 03:10 PM   #3
Anti-Poster
 
Join Date: Feb 2002
Posts: 1,241
I have an idea for another one that would pit each entry against the others in an AI match. How does that sound?
__________________
Rule #1: Every rule has exceptions
pianorain is offline   Reply With Quote
Old 06-21-2006, 11:16 PM   #4
int x = *((int *) NULL);
 
Cactus_Hugger's Avatar
 
Join Date: Jul 2003
Location: Banks of the River Styx
Posts: 902
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!
__________________
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)
Cactus_Hugger is offline   Reply With Quote
Old 06-22-2006, 09:14 AM   #5
Registered User
 
Join Date: Jan 2005
Posts: 847
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.
Quantum1024 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Results - 4th contest, saturday, august 11 ygfperson A Brief History of Cprogramming.com 17 08-12-2002 09:41 AM
Results for *easy* contest: ygfperson A Brief History of Cprogramming.com 15 07-27-2002 11:35 AM
Results for the Encryption Contest -- June 23, 2002 ygfperson A Brief History of Cprogramming.com 18 07-07-2002 08:04 AM
Contest Results - May 27, 2002 ygfperson A Brief History of Cprogramming.com 18 06-18-2002 01:27 PM


All times are GMT -6. The time now is 05:34 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22