🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4129

Re: Maze game in 'C' desparate

#4129
From: Rick Perry
Date: Tue, 26 Sep 1995 22:36
27 lines
1730 bytes
conlib@ccnet.com (Concord Library) writes:
>I am a student who is in search of info about getting a program written
>in C and it is a maze game. ... due this coming Friday.

You're in luck.  I just happened to have saved such a program from the
obfuscated C contest of 1985 (shapiro.c).  Just make some minor changes,
add some comments, and draw a flowchart.  And don't post homework questions
here anymore until you understand this program throughly:

#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
);}

Please give some credit to the author of that program, "<otto!carl> Carl
Shapiro", who probably got a C++ grade in C; which may be higher than your
grade will be...

...Rick		perry@ece.vill.edu, http://www.ece.vill.edu/~perry

Dr. Rick Perry, ECE Department, Villanova University, Villanova, PA 19085
610-519-4969, fax: 610-519-4436, hm: 610-259-8734
Technical Details
Message-ID: <449v9a$i0d@ftp.ee.vill.edu>
Path: arc1-ca.pugleaf.net!news.ee.vill.edu!not-for-mail
References: <447i7p$kfu@ccnet3.ccnet.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.ee.vill.edu!not-for-mail
From: perry@ftp.ee.vill.edu (Rick Perry)
Newsgroups: comp.std.c
Subject: Re: Maze game in 'C' desparate
Date: 26 Sep 1995 18:36:26 -0400
Organization: Villanova University
Message-ID: <449v9a$i0d@ftp.ee.vill.edu>
References: <447i7p$kfu@ccnet3.ccnet.com>
NNTP-Posting-Host: ftp.ee.vill.edu
X-Newsreader: NN version 6.5.0 CURRENT #2