Originally Posted by
zzzaaahhh
Also, I have a question about your two macros:
Code:
#define A _[y][x]
#define C(D,E,F,G,H)if(D&&_[E][F]){A|=G;_[E][F]|=H;}else
Is that "A" in the second line supposed to be substituted from the first line? I didn't know you could do that (macros within macros). Is that standard, or implementation dependent?
Yes and yes, it's standard. You can even have macros with the name of the macro appearing in the macro itself. However, some old compilers may not like it and try to continually expand it. So that's generally avoided.
Originally Posted by
PJYelton
Quzah, did you post all of the entries you recieved? Can't tell if you are still writing results or not and I'd be curious to see how mine fared even though I know I didn't come close to winning.
I wasn't sure if you wanted it entered. Here it is:
:~/programming/maze$ ls -al pjyelton.cpp
-rwxrwxr-x 1 root windows 556 Oct 12 19:06 pjyelton.cpp
As is, the output was:
Code:
*****************************************
*.*.....................*.....*.........*
*.*.*****************.*.*.*****.*******.*
*.*...*.............*.*...*.....*.....*.*
*.***.*.***********.*.*****.*****.***.*.*
*.*...*.......*.*...*.....*.*.*.....*.*.*
*.*.*********.*.*.*******.*.*.*.*****.*.*
*.*.........*...*.*.....*.*.*...*.....*.*
*.*********.*.***.*.***.*.*.*.***.***.*.*
*.*.....*...*.*...*...*...*.*...*...*.*.*
*.*****.*.***.*.*****.*****.*******.*.*.*
*.*.....*...*.*...*...*.....*.......*.*.*
*.*.*******.*.***.*.***.*****.*********.*
*.*.......*.*.*.*.*.*...*.....*.......*.*
*.***.***.*.*.*.*.*.*.***.*****.*****.*.*
*...*.*...*.*.*.*.*...*...*.....*.......*
***.***.***.*.*.*.*****.***.***********.*
*...*...*...*...*.*.......*...*.......*.*
*.***.***.*****.*.*.*****.***.*.*****.***
*.*...........*.*.......*...*.*.*...*...*
*.***********.*********.*.*.*.*.*.*****.*
*.......*.....*.......*.*.*.*...*.....*.*
*******.***.***.*****.***.*.*****.***.*.*
*.....*...*.*.......*.....*.*.....*...*.*
*.***.***.*.*******.*******.*.*****.***.*
*.*.*.....*...*.....*...*...*.*...*...*.*
*.*.*********.*.*****.*.***.*.*.*.***.*.*
*.....*.....*.*.......*...*.*...*...*.*.*
*****.*.*.*.*.*.*********.*.*****.***.*.*
*.....*.*.*.*.*...*.....*.*...*...*...*.*
*.*****.*.***.***.*.***.*.***.*.***.***.*
*.*...*.*.*...*...*...*.*...*.*.*...*...*
*.*.***.*.*.*****.*****.***.*.*.*.***.***
*.*.....*...*...*.*...*...*.*.*.*...*...*
*.***.*******.*.*.*.*.*.***.*.*****.***.*
*...*.........*.*...*...*...*.......*.*.*
***.*.*********.*********.*.*******.*.*.*
*.*.*.*.....*.............*.*...*.....*.*
*.*.***.***.*****************.*.*******.*
*.......*.....................*.........*
*****************************************
It also meets the requirements as far as resizability and the like. The code itself is:
Code:
#include<iostream>
#include<time.h>
#define X 20
#define Y 20
#define c std::cout<<
#define i int
#define M m[x][y]
#define U m[x+e[v][0]][y+e[v][1]]
#define u x+e[v][0],y+e[v][1]
#define v z%4
#define f(o,p) for(o=0;o<p;o++)
char m[X][Y]={0};bool w(i x,i y){return(x<0||y<0||y==Y||x==X);}i e[4][2]={{0,-1},{-1,0},{0,1},{1,0}};void R(i x,i y){i z=rand()%4;i q;f(q,4){z++;if(!w(u)&&!U){M|=1<<v;U|=1<<(v+2)%4;R(u);}}}i main(){srand(time(0));i x,y;R(0,0);c"*";f(x,X)c"**";c"\n";f(y,Y){f(x,X)(M&2)?c"..":c"*.";c"*\n";f(x,X)(M&4)?c"*.":c"**";c"*\n";}return 0;}
Pointwise, we'd end up with:
1000 - (56 * 10) = 440 points.
However, that one huge line of code would anger everyone if you did manage to fit it in your sig.
Quzah.