Maze generation

Israel Pinkas pinkas at st860.intel.com
Tue Dec 18 12:48:17 AEST 1990


In article <1990Dec15.093542.2725 at pegasus.com> tleylan at pegasus.com (Tom Leylan) writes:

> Scott... it looked so cute that I tried it but no maze.  It printed a
> repeated pattern though.  Made me suspect that the RAND() function might
> be operating differently.  I'm using Microsoft C and it returns a random
> value between 1 and 32767.  Does this appear to conflict with anything ?

Yep, that's the problem.  The BSD version of rand() returns a number
between 0 and 2^31-1, whereas the System V and DOS versions return a number
between 0 and 2^15-1.  Since the return value is compared against 6<<27,
the test always fails on DOS and SysV machines.

Change the 27 on the last line to 11 and you should get better results.

> BTW, if I was forced to guess it's origins it "looks" like an entry in
> the obfuscated code contest that someone holds each year.

I believe that it is from the 1989 contest.


-Israel Pinkas
--
--------------------------------------
Disclaimer: The above are my personal opinions, and in no way represent
the opinions of Intel Corporation.  In no way should the above be taken
to be a statement of Intel.

UUCP:	{amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!st860!pinkas
ARPA:	pinkas%st860.intel.com at relay.cs.net
CSNET:	pinkas at st860.intel.com



More information about the Alt.sources.d mailing list