Then why does your signature have all these names?
Edit: Oh, they say they have entered in a post.Darryl
Quantum1024
twomers
Cactus_Hugger
evoltix
Then why does your signature have all these names?
Edit: Oh, they say they have entered in a post.Darryl
Quantum1024
twomers
Cactus_Hugger
evoltix
Last edited by Dante Shamest; 05-31-2006 at 09:42 PM.
I will get around to finnishing my entry soon, hopefully.Quantum1024
I am also participating.
Just a quick question, how do you go about testing your function?
I test mine by generating a few random boards and running my function on each one.
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
So, I'm assuming that we have to write the code to test it? Correct?
For what it's worth, here's my tester... you can change the grid as you see fit. I actually had an elaborate way of converting the boards from ebaum into my grid. From ebaum you can't just copy and paste, however, right clicking gave me an option to print and since I have adobe acrobat, I could print to pdf where then I could cut and paste the grid.
(during coding, I also had output that gave me the running score as it solved, but I removed it before I submitted and didn't think to save it.)
Code:#include "snake_cpp.h" #include <iostream> #include <string> std::string names[] = { "North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest" }; int c[18][18]; int b[18][18]={ {5,1,4,1,6,3,5,3,6,1,4,2,4,6,2,1,5,2}, {2,2,4,1,1,4,3,2,4,2,3,4,1,1,2,1,5,2}, {6,4,4,6,5,4,6,2,5,6,3,3,5,5,8,3,5,1}, {4,4,8,2,1,1,3,5,1,5,1,6,6,1,2,2,6,4}, {2,5,5,1,1,4,5,1,6,2,4,4,1,5,4,5,6,4}, {5,1,2,5,4,3,1,2,1,4,6,4,6,2,3,3,3,6}, {6,3,1,6,6,6,3,5,1,1,4,2,4,4,6,3,4,5}, {4,4,3,4,6,6,8,9,6,4,3,5,5,4,3,4,5,2}, {3,4,6,4,1,4,2,2,6,3,6,2,3,6,1,1,3,3}, {2,6,4,3,2,1,2,2,5,5,3,3,4,5,3,5,1,6}, {2,4,4,6,2,6,3,3,1,6,6,2,3,1,5,4,6,5}, {5,6,3,1,3,6,4,3,1,4,5,4,3,6,3,3,1,1}, {1,6,3,1,1,6,5,4,5,1,2,5,1,6,3,3,4,2}, {1,3,1,1,4,2,5,1,2,3,6,4,1,4,2,2,5,2}, {2,5,4,6,5,5,4,4,3,3,2,1,2,5,1,4,2,4}, {6,6,2,1,2,2,3,5,1,4,3,2,1,8,1,5,3,4}, {4,6,6,6,1,2,4,3,1,3,3,2,4,2,6,1,6,2}, {6,3,4,2,5,6,5,1,4,2,2,4,2,3,8,3,5,2}}; std::vector<Direction> ml; int main() { for(size_t x = 0; x < 18; ++x) for(size_t y = 0; y < 18; ++y) c[y][x] = b[x][y]; SnakeNumbers(c,ml); for (size_t i = 0; i < ml.size();i++) { std::cout << names[ml[i]] << "\n"; } }
Last edited by Darryl; 06-05-2006 at 11:08 AM.
Here's the code I've been using to generate random boards:Code:void GenerateBoard(int board[18][18]) { int x,y,i; srand(time(NULL)); for(x = 0; x < 18; x++) for(y = 0; y < 18; y++) board[x][y] = rand() / ( RAND_MAX / 6 + 1 ) + 1; for(i = 0; i < 5; i++) { do { x = rand() / ( RAND_MAX / 18 + 1 ); y = rand() / ( RAND_MAX / 18 + 1 ); } while(board[x][y] == BOMB); board[x][y] = BOMB; } do { x = rand() / ( RAND_MAX / 18 + 1 ); y = rand() / ( RAND_MAX / 18 + 1 ); } while(board[x][y] == BOMB); board[x][y] = SNAKE_HEAD; }
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
A reminder: submissions are due in 1 week.
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
Just a quick question, when programming C++ in Visual Studio do you guys use Visual Studio 2003 or 2005? When I have tried to use 2005 to develop in C++ I've noticed differences. Are programs that are developed in C++ using Visual Studio 2003 just as good or the same as if they were developed using Visual Studio 2005? Are the differences different since in 2005 the IDE uses .NET Framework 2.0? Also, at what point does Visual Studio 2003 become obsolete?
P.S. Do we just add our code to the snake_cpp.h file and submit that?
Last edited by evoltix; 06-10-2006 at 03:44 PM.
I'd prefer for your code to come in its own seperate source file.Originally Posted by evoltix
Two days left. So far, I've only received one entry.
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
sent.
Hehe... I know. It's summer, I'm lazy. But I'm almost done too.
I'm rather pleased, hopefully I can give the other contestants a run for their money. Mine scores from about 165 - 185 in 3 - 4sec. (My PC is crap btw: 450MHz AMD w/ 192MB RAM.) Unfortunately, this being summer, I don't have a real PC to test this on, which is always nice.
Going to tweak a bit more... and run under Linux, see how it performs there. (And how it badly it creams Windows! Everytime I put that MS-DOS prompt in the background, Windows forgets about it... "multitasking"...)
Oh yeah, two things:
1) I got gently reminded of how expensive Disk I/O was...
2) Flowcharts. They help, a lot. Say what you want, but when you're having code block from trying to convert thought to code, try one.
EDIT: Sent... so now I wait. :-) Good luck to the rest.
Last edited by Cactus_Hugger; 06-14-2006 at 12:22 AM.
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)
Sorry guys but I never got mine submitted since I've been really busy at work and school. Being a fulltime programmer and going to school for computer science really fills my schedule. I did start coding it but never was able to finish it. I'm curious to see how you all solved this type of problem in code. I hope to get into the next contest and actually get something turned in. Good luck to you all!