Re: C question for you old guys ;-)
Re: C question for you old guys ;-)
- Subject: Re: C question for you old guys ;-)
- From: Lloyd Dupont <email@hidden>
- Date: Tue, 10 Jun 2003 15:52:21 +1000
I confirm, it work well !!
It compiled for me and outputs a pretty maze - amazing! Were did it
come from?
#define P(X)j=write(1,X,1)
#define C 39
int
M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-
1,C},*b=N,
*d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-
1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0;
s<4;s++)if((k=m[s]+g)>=0&&k<C*R&&l[s]!=k%C&&(!M[k]||!j&&c>=16!=M[k]>=
16))a[f++
]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=j<f?f:j;f+=c&-
16*!j;M[g]=
c|1<<s;M[*d++=e]=f|1<<(s+2)%4;}else e=d>b++?b[-1]:e;}P("
");for(s=C;--s;P("_")
)P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2))P("|
"+(*u/4)%2
);}
The above does not compile as a standard tool and I ain't gonna debug
it.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _
|_ _ _| |_ |_ _ _ | _ | _ | | _ _ _ |_ _ _ _ _ _ _ _
_| _ |
| _ _ _ _| |_ _ _| _ _ _ _|_ _|_ |_ _|_ _|_ |_ _ | | _ _ _ _ _
| | _|
| | _ | _ _ | |_ _ _| _ | | _ _ _ _| | | |_ _| |_
|_ _| | |
| |_ _| | _ |_ _| _ _ |_ | | | | |_ _ _|_ _|_ _| _|_ | |_
| _| |
|_ _ _| | | | _ _ _ _|_ | | _|_ |_| |_| | | | _ | |_ _ _|_ _|
| | |
| | _|_| | | _ _ _ _|_| | _ _| | _| | | |_ _| |_ _| _ _ |
_|_ _| |
| |_ _|_ _ _| | |_ _ _ | _ _| | | _|_| |_ _|_ | | |_ _ _ | |_
_ _ |
| | _ | _ _| | |_ _|_ _ _| |_ _|_ | | _ _ | | | |_| _| _|_ _
_ _ | |
| |_ |_ | |_ _|_ _ _ _| _| | _| | | |_| | |_ | | _| _ _
_ | | |
| | _| | | |_ _ _ _ _ _| _ _|_ _| | | | _| |_ _ _|_ | |_ _|_ _|
_ _| | |
| | |_ _| _| _ _ | _| | _ _| _ _| _| _ _ _| | _ | _ _|
| _| |
| | |_ _ _ _ _ _|_ |_ _| | | | | | |_ |_ _| | _| | _| | | | |
_| | _|
| |_ | _ _ _ | _ |_ _| |_ _| |_ |_ _ _ _| | _|_ | | |_ _| |_
_ _|_ |
| |_ _| | _ _ _| | |_ _ _ | _ _| |_ | _ _ _| | | _| | | | | |
| | |
| _ _|_ | | |_|_ _ | | | _ _ | | |_ _ | _| _| _| | |_| _|
| |_ _|
| | |_ | | | |_ | |_ _| | |_ | | _| _ |_ | |_ | _ _| _ _
_|_ _ _|
| |_ _ _| |_| |_ |_ _|_ _ _| | | _| | | |_ _| _|_ | | | _ _| _
_ _ |
| _ |_ |_ | | _ _ _| | _| | | | |_ _ _| |_ _ | |
| | _|
| |_ | | |_ _| | | _| |_ _ |_ _ _| | | |_ _ | | |_ |
|_|_|_ _|_ |
|_ |_| | |_ | | | |_ _ _| | _ _ _ _ | |_|_ _ _| |_ _|_ | | | |
| _| |
| |_ | |_ _|_ | | | |_ _|_| |_ | |_ | _ _ _ _ _ _ _|_ _| |_| |
| _|
|_ _ _|_ _ _ _ _|_|_ _|_ _ _ _ _|_ _ _|_ _ _|_ _ _ _ _ _ _ _ _ _|_ _
_|_ _|_ |
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.