<!-- MHonArc v2.4.4 --> <!--X-Subject: [MUD-Dev] AFAP: As fast as possible, non linear... --> <!--X-From-R13: "dhmnu Mfbsgubzr]" <dhmnuNfbsgubzr.arg> --> <!--X-Date: Sun, 13 Dec 1998 22:41:45 -0800 --> <!--X-Message-Id: 002001be272d$64aca440$a3066520@k6 --> <!--X-Content-Type: text/plain --> <!--X-Head-End--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>MUD-Dev message, [MUD-Dev] AFAP: As fast as possible, non linear...</title> <!-- meta name="robots" content="noindex,nofollow" --> <link rev="made" href="mailto:quzah#softhome,net"> </head> <body background="/backgrounds/paperback.gif" bgcolor="#ffffff" text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000"> <font size="+4" color="#804040"> <strong><em>MUD-Dev<br>mailing list archive</em></strong> </font> <br> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] <br clear=all><hr> <!--X-Body-Begin--> <!--X-User-Header--> <!--X-User-Header-End--> <!--X-TopPNI--> Date: [ <a href="msg00962.html">Previous</a> | <a href="msg00964.html">Next</a> ] Thread: [ <a href="msg01055.html">Previous</a> | <a href="msg00966.html">Next</a> ] Index: [ <A HREF="author.html#00963">Author</A> | <A HREF="#00963">Date</A> | <A HREF="thread.html#00963">Thread</A> ] <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--> <H1>[MUD-Dev] AFAP: As fast as possible, non linear...</H1> <HR> <!--X-Subject-Header-End--> <!--X-Head-of-Message--> <UL> <LI><em>To</em>: <<A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A>></LI> <LI><em>Subject</em>: [MUD-Dev] AFAP: As fast as possible, non linear...</LI> <LI><em>From</em>: "quzah [softhome]" <<A HREF="mailto:quzah#softhome,net">quzah#softhome,net</A>></LI> <LI><em>Date</em>: Sun, 13 Dec 1998 22:45:49 -0800</LI> <LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI> </UL> <!--X-Head-of-Message-End--> <!--X-Head-Body-Sep-Begin--> <HR> <!--X-Head-Body-Sep-End--> <!--X-Body-of-Message--> <PRE> Hiya all. I'm finishing up a tiny maze generator, and all I need is a tad bit of a speed gain. (Or more than a tad. :) I'm using a 10x10x10 cube, generated a plane at a time (10x10). I am linking them through one exit per plane (up/down), with the bottom level's exit leading "out". Here's the basic rundown: void mazePunch( char startX, char startY, char startZ, bool nuke){ static char path[100]; static char used; /* if nuke, zero the path, simple linear for() loop */ /* then trash 'used' */ /* startX and startY determine this planes 'current' location. { If any neighbor is zero (unused), note it (valid). Pick from the list of valid neighbors at random to use. Knock out the wall, them to us. Increment 'used'. If current == 0, increment 'used'. Knock out the wall, us to them. } { If no neighbors were zero, and we are zero, punch a hole from us to any valid neighbor (valid this time being an in bounds coord.) Increment 'used' since we are no longer zero. } if( used < 100 ) recursive call with new coords for x and y. else return */ } That about does it. The only thing I don't like about it is that that I have a crappy way of getting the new coords for the next recursive call. I'm currently using: mazePunch( number_range(0,9), number_range(0,9), FALSE ); Now, I know there has to be a much faster, non linear way to do this, but I haven't thought of it yet, so I though it time I got a bit of help for this snippet. :) The rest I'm pretty pleased with. I'm thinking it should be pretty fast if I get around the coord picking I'm using now. So, does anyone have a quick way to grab a zero coord? (Oh, hmm, I just thought of a way I'll try, but I'll post this anyway. I'll just run the list of used and grab a random one of those with a zero neighbor. -- Anyway while I try that, does anyone have any other faster/better ways to do the coord grabbing?) Thanks in advance. Quzah. </PRE> <!--X-Body-of-Message-End--> <!--X-MsgBody-End--> <!--X-Follow-Ups--> <HR> <ul compact><li><strong>Follow-Ups</strong>: <ul> <li><strong><A NAME="00972" HREF="msg00972.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong> <ul compact><li><em>From:</em> Mik Clarke <mikclrk#ibm,net></li></ul> <li><strong><A NAME="00968" HREF="msg00968.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong> <ul compact><li><em>From:</em> Jon Leonard <jleonard#divcom,slimy.com></li></ul> <li><strong><A NAME="00967" HREF="msg00967.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong> <ul compact><li><em>From:</em> Dan Shiovitz <dbs#cs,wisc.edu></li></ul> <li><strong><A NAME="00966" HREF="msg00966.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong> <ul compact><li><em>From:</em> Mik Clarke <mikclrk#ibm,net></li></ul> </UL></LI></UL> <!--X-Follow-Ups-End--> <!--X-References--> <!--X-References-End--> <!--X-BotPNI--> <UL> <LI>Prev by Date: <STRONG><A HREF="msg00962.html">[MUD-Dev] mud client development systems</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg00964.html">[MUD-Dev] Re: MUD Design doc (long)</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg01055.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg00966.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="index.html#00963"><STRONG>Date</STRONG></A></LI> <LI><A HREF="thread.html#00963"><STRONG>Thread</STRONG></A></LI> </UL> </LI> </UL> <!--X-BotPNI-End--> <!--X-User-Footer--> <!--X-User-Footer-End--> <ul><li>Thread context: <BLOCKQUOTE><UL> <LI><STRONG>[MUD-Dev] Re: Graphic design, client questions</STRONG>, <EM>(continued)</EM> <ul compact> <LI><strong><A NAME="00989" HREF="msg00989.html">[MUD-Dev] Re: Graphic design, client questions</A></strong>, Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Fri 18 Dec 1998, 00:52 GMT </LI> </ul> </LI> <LI><strong><A NAME="00970" HREF="msg00970.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong>, quzah [softhome] <a href="mailto:quzah#softhome,net">quzah#softhome,net</a>, Tue 15 Dec 1998, 12:30 GMT <UL> <li><Possible follow-up(s)><br> <LI><strong><A NAME="00974" HREF="msg00974.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong>, quzah [softhome] <a href="mailto:quzah#softhome,net">quzah#softhome,net</a>, Wed 16 Dec 1998, 12:29 GMT </LI> <LI><strong><A NAME="01055" HREF="msg01055.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong>, quzah [softhome] <a href="mailto:quzah#softhome,net">quzah#softhome,net</a>, Tue 29 Dec 1998, 08:27 GMT </LI> </UL> </LI> <LI><strong><A NAME="00963" HREF="msg00963.html">[MUD-Dev] AFAP: As fast as possible, non linear...</A></strong>, quzah [softhome] <a href="mailto:quzah#softhome,net">quzah#softhome,net</a>, Mon 14 Dec 1998, 06:41 GMT <UL> <LI><strong><A NAME="00966" HREF="msg00966.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong>, Mik Clarke <a href="mailto:mikclrk#ibm,net">mikclrk#ibm,net</a>, Tue 15 Dec 1998, 04:05 GMT <UL> <LI><strong><A NAME="00969" HREF="msg00969.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong>, Alex Oren <a href="mailto:alexo#bigfoot,com">alexo#bigfoot,com</a>, Tue 15 Dec 1998, 10:01 GMT </LI> </UL> </LI> <LI><strong><A NAME="00967" HREF="msg00967.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong>, Dan Shiovitz <a href="mailto:dbs#cs,wisc.edu">dbs#cs,wisc.edu</a>, Tue 15 Dec 1998, 06:18 GMT </LI> <LI><strong><A NAME="00968" HREF="msg00968.html">[MUD-Dev] Re: AFAP: As fast as possible, non linear...</A></strong>, Jon Leonard <a href="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</a>, Tue 15 Dec 1998, 07:27 GMT </LI> </UL> </LI> </UL></BLOCKQUOTE> </ul> <hr> <center> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>