Thread: Contest - Snake Numbers

  1. #1
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401

    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?

    [edit]See rules below.[/edit]
    Last edited by pianorain; 05-17-2006 at 09:42 AM.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  2. #2
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    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. #3
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I'd participate.

  4. #4
    Registered User
    Join Date
    May 2006
    Location
    Troy
    Posts
    14
    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. #5
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    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. #6
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    Quote 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. #7
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Snake Numbers Contest

    Schedule / Deadline
    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: [email protected]
    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.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  8. #8
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    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. #9
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    I'm in too.

  10. #10
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Quote 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.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  11. #11
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Quote Originally Posted by pianorain
    I'll be compiling with Microsoft Visual Studio 2005.
    Is it reliable?

  12. #12
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    I've not had any problems with it. :shrug:

    [edit] On the other hand, I've got 2003 and VS 6 installed too, so if any problems pop-up, I can use those also.
    Last edited by pianorain; 05-17-2006 at 02:33 PM.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  13. #13
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    As is mentioned in that thread using standard c functions can produce a lot of warnings dose that count?

  14. #14
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    No. Like I said, it hasn't given me any problems. Including that define turns all of those warnings off.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  15. #15
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    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!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  2. Contest Results - Snake Numbers
    By pianorain in forum Contests Board
    Replies: 4
    Last Post: 06-22-2006, 09:14 AM
  3. linked list problem
    By kzar in forum C Programming
    Replies: 8
    Last Post: 02-05-2005, 04:16 PM
  4. the definition of a mathematical "average" or "mean"
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 12-03-2002, 11:15 AM