# Thread: Contest - Snake Numbers

1. ## Contest - Snake Numbers

It's been a while since a contest has been posted. Here's a fairly simple one.

Write a function that can play Snake Numbers, leaving the fewest number of squares. The rules for Snake Numbers are simple:
• The board is an 18x18 square of numbers ranging from 1-6. There are 5 bombs randomly placed on the board. The starting location is random on each board.
• The object is to eliminate as many squares as possible by travelling over them.
• On each turn, the snake head must go in one of eight directions (any of the cardinal or ordinal directions). The snake head travels a number spaces equal to the value of the square adjacent to the snake head in the chosen direction. The snake leaves a tail behind on all squares travelled over.
• If the snake travels over a bomb, its tail, or one of the sides of the board, the game is over.

Before I start spouting off stuff about entries and judging, is there any interest in this contest?

See rules below.[/edit]

2. Yea I would participate. Looks like a good challange.

PS. For those wondering about the Texas Holdem, it's still coming, I just got real busy at work.

3. I'd participate.

4. Sure, but have the game run over stdin and stdout, not some class. And, um, specify a wide set of options for the programming language to use. (Including Scheme :-). Or else I'll write Scheme code and then compile it to incomprehensible C++.)

5. I'll do it ... I will wait till my exams are finished though, so that's about 10 days from now. When will it start? Sounds like a good one!!

6. Originally Posted by Rash
Sure, but have the game run over stdin and stdout, not some class. And, um, specify a wide set of options for the programming language to use. (Including Scheme :-). Or else I'll write Scheme code and then compile it to incomprehensible C++.)
The problem with allowing many programming languages is that most people don't want to accept binaries and don't want to have to support compiling a whole mess of different languages. Besides this is a C/C++ programming forum.

7. Snake Numbers Contest

Start Date: May 17th, 2006
End Date: June 14th, 2006

Submissions
If you choose to enter, please reply stating that you have entered the contest, and before the Contest deadline you must enter a submission that meets the stated requirements and send it to the submission officer via email or private message. E-mail is preferred.

E-mail: pianorain@bellsouth.net
PM: pianorain

Introduction
Write a function that can play Snake Numbers, leaving the fewest number of squares. The rules for Snake Numbers are simple:
• The board is an 18x18 square of numbers ranging from 1-6. There are 5 bombs randomly placed on the board. The starting location is random on each board.
• The object is to eliminate as many squares as possible by travelling over them.
• On each turn, the snake head must go in one of eight directions (any of the cardinal or ordinal directions). The snake head travels a number spaces equal to the value of the square adjacent to the snake head in the chosen direction. The snake leaves a tail behind on all squares travelled over.
• If the snake travels over a bomb, its tail, or one of the sides of the board, the game is over.

Details
Entries will be accepted in C, C++, or C#. Fill free to create and submit additional helper functions and methods.

C
Write a function that matches the following prototype:
Code:
`void SnakeNumbers(int board[18][18], enum Direction moveList[318]);`
board will contain values ranging from 1-6 (normal squares), SNAKE_HEAD, SNAKE_TAIL, and BOMB. You should fill moveList with the sequence of moves from the starting position. The last move should be 0 (or Empty).
Use the following header file: snake_c.h

C++
Write a function that matches the following prototype:
Code:
`void SnakeNumbers(int board[18][18], std::vector<Direction>& moveList);`
board will contain values ranging from 1-6 (normal squares), SNAKE_HEAD, SNAKE_TAIL, and BOMB. You should fill moveList with the sequence of moves from the starting position.
Use the following header file: snake_cpp.h

C#
Write a class that implements the following interface:
Code:
```public interface ISnakeNumbers
{
Collection<Direction> SnakeNumbers(int[,] board);
}```
board will contain values ranging from 1-6 (normal squares), SnakeNumbers.SnakeHead, SnakeNumbers.SnakeTail, and SnakeNumbers.Bomb. The return value should contain the sequence of moves from the starting position.
Use the following code file: SnakeCSharp.txt

Contest Rules
Below are the current contest rules and regulations.

I. Official Rules
I.I You may only submit one entry per contest, and it must have been submitted between the contest start and end dates.

I.II Entries submitted should be:
• Substantially the developer's original design
• Substantially the developer's original programming
• In C, C++, or C#

II. Code Judging
II.I Submitted code will be judged based on the following:

Compiliation (0 - 5 x5)
How easy it is to compile. Warnings detract from this score.

Success x 5 (0.0 - 10.0)
Each entry will be given five boards to solve. This will be graded depending upon how well the code performs the desired task.

Time x 5 (0.0 - 10.0)
Each entry will be given five boards to solve. This will be graded depending upon how fast the code performs the desired task compared to the other entries.

Coding Style(0 - 5 x5)
Code efficiency, is the code readable? Are good programming practices followed? (Are processes closed when finished, do you use arrays when initializing multiple variables under one instance, and do you free memory after allocation?)

Best Code Score: 150.0

Contest outline borrowed from Stack Overflow. IMO, his outline should be sticked or something; it looks good and provides a clean start for people starting a contest.

8. I'm in.

Compiliation (0 - 5 x5)
How easy it is to compile. Warnings detract from this score.
Ok based on this statement, it might help to know what compiler you will use.

9. I'm in too.

10. Originally Posted by Darryl
Ok based on this statement, it might help to know what compiler you will use.
I'll be compiling with Microsoft Visual Studio 2005.

11. Originally Posted by pianorain
I'll be compiling with Microsoft Visual Studio 2005.
Is it reliable?

12. I've not had any problems with it. :shrug:

 On the other hand, I've got 2003 and VS 6 installed too, so if any problems pop-up, I can use those also.

13. As is mentioned in that thread using standard c functions can produce a lot of warnings dose that count?

14. No. Like I said, it hasn't given me any problems. Including that define turns all of those warnings off.

15. But, you could always download Dev or something, and test it in that ... where I don't think the errors occur. But, it's never givenme any problems either!