home *** CD-ROM | disk | FTP | other *** search
- From: xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan)
- Newsgroups: rec.games.programmers,alt.sources,alt.sources.amiga
- Subject: townmaze, patch 2
- Message-ID: <1991Apr23.180113.11575@zorch.SF-Bay.ORG>
- Date: 23 Apr 91 18:01:13 GMT
-
- Archive-name: townmaze/patch2
-
- Another bug that got past a couple of forgiving systems and died cold on
- a system with strict memory checking; I got a little outside the bounds
- of cmaze[][] under occasional maze seed dependent conditions due to two
- sign errores in closegates.c math and tromped on unallocated memory.
-
- It was not a bug exactly, but the massive while statement condition at
- the bottom of makeunused.c blew away the parse buffer available storage
- for a couple of users' compilers. I pulled it out and made it a separate
- routine "wimpy_cc()" in the same file.
-
- Thanks for problem report inputs that led to this patch to:
-
- Stefan M. Linnemann <crissl@rulcvx.LeidenUniv.nl>
- dwade@jarthur.Claremont.edu
- rmk@rmkhome.uucp (Rick Kelly)
-
- I appreciate the help!
-
- changes:
-
- CHANGES
-
- Updated with this information.
-
- patchlevel.h
-
- Updated to patchlevel 2
-
- closegates.c
-
- Fixed two bugs in gatewalking code that was stepping outside the cmaze[]
- limits, thanks to a bug report and patch supplied by Stefan M. Linnemann
- <crissl@rulcvx.LeidenUniv.nl>. Added comments to a few associated lines.
-
- makeunused.c
-
- The 59 condition check in the do{}while loop's condition was overflowing
- parse buffers on some smaller compilers, so it has now become a separate
- routine, wimpy_cc() <Heh!> internal to makeunused.c. Thanks for reports
- from dwade@jarthur.Claremont.edu and rmk@rmkhome.uucp (Rick Kelly) of the
- problem.
-
- townmaze.test
-
- Clarified the descriptions for two tests; I'd muddled the effect a
- courtyard or its lack could produce in a small maze.
-
- townpgmr.doc
-
- Updated to reflect the changes in makeunused.c.
-
- As with the previous patch, unpack this shar in the directory where your
- townmaze source is, and do "patch < patch02". This shar and patch have
- been tested against the patch level 1 townmaze code and worked OK here.
-
- Enjoy!
-
- Kent, the man from xanth.
- <xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us>
-
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 1)."
- # Contents: MANIFESTp1.2 patch02
- # Wrapped by xanthian@zorch on Tue Apr 23 10:28:48 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'MANIFESTp1.2' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MANIFESTp1.2'\"
- else
- echo shar: Extracting \"'MANIFESTp1.2'\" \(176 characters\)
- sed "s/^X//" >'MANIFESTp1.2' <<'END_OF_FILE'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X MANIFESTp1.2 1 This shipping list
- X patch02 1
- END_OF_FILE
- if test 176 -ne `wc -c <'MANIFESTp1.2'`; then
- echo shar: \"'MANIFESTp1.2'\" unpacked with wrong size!
- fi
- # end of 'MANIFESTp1.2'
- fi
- if test -f 'patch02' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patch02'\"
- else
- echo shar: Extracting \"'patch02'\" \(22788 characters\)
- sed "s/^X//" >'patch02' <<'END_OF_FILE'
- XThis says there should be a patchlevel.h file containing a 1; it should
- Xremain from installing patch 1. It will be updated to be patchlevel 2 by
- Xthis patch. Kent.
- X
- XPrereq: 1
- X
- X*** patchlevel.h.old Tue Apr 23 09:17:58 1991
- X--- patchlevel.h Tue Apr 23 09:17:39 1991
- X***************
- X*** 1 ****
- X! #define patchlevel 1
- X--- 1 ----
- X! #define patchlevel 2
- X*** CHANGES.old Fri Apr 19 23:47:44 1991
- X--- CHANGES Tue Apr 23 09:38:28 1991
- X***************
- X*** 1,5 ****
- X--- 1,38 ----
- X CHANGES -- change record for townmaze
- X
- X+ v 1.2 23 April 1991
- X+
- X+ CHANGES
- X+
- X+ Updated this file.
- X+
- X+ patchlevel.h
- X+
- X+ Set to patchlevel 2.
- X+
- X+ closegates.c
- X+
- X+ Fixed two bugs in gatewalking code that was stepping outside the cmaze[]
- X+ limits, thanks to a bug report and patch supplied by Stefan M. Linnemann
- X+ <crissl@rulcvx.LeidenUniv.nl>. Added comments to a few associated lines.
- X+
- X+ makeunused.c
- X+
- X+ The 59 condition check in the do{}while loop's condition was overflowing
- X+ parse buffers on some smaller compilers, so it has now become a separate
- X+ routine, wimpy_cc() <Heh!> internal to makeunused.c. Thanks for reports
- X+ from dwade@jarthur.Claremont.edu and rmk@rmkhome.uucp (Rick Kelly) of the
- X+ problem.
- X+
- X+ townmaze.test
- X+
- X+ Clarified the descriptions for two tests; I'd muddled the effect a
- X+ courtyard or its lack could produce in a small maze.
- X+
- X+ townpgmr.doc
- X+
- X+ Updated to reflect the changes in makeunused.c.
- X+
- X v 1.1 20 April 1991
- X
- X CHANGES
- X*** closegates.c.old Tue Apr 23 07:49:17 1991
- X--- closegates.c Tue Apr 23 08:04:24 1991
- X***************
- X*** 49,76 ****
- X
- X for (gatewalk = 0; gatewalk < possiblegates; gatewalk++)
- X {
- X! if (gatewalk < (mazewidth-1)/2)
- X {
- X mazei = 0;
- X mazej = 2 * gatewalk + 1;
- X }
- X else
- X! if (gatewalk < ((mazewidth-1)/2 + (mazeheight-1)/2))
- X {
- X mazei = 2 * (gatewalk - (mazewidth-1)/2) + 1;
- X mazej = mazewidth-1;
- X }
- X else
- X! if (gatewalk < ((mazewidth-1) + (mazeheight-1)/2))
- X {
- X mazei = mazeheight-1;
- X! mazej = 2 * (((mazewidth-1)/2)-
- X! (gatewalk-((mazewidth-1)/2 + (mazeheight-1)/2))) + 1;
- X }
- X! else
- X {
- X! mazei = 2 * (((mazeheight-1)/2)-
- X! (gatewalk-((mazewidth-1) + (mazeheight-1)/2))) + 1;
- X mazej = 0;
- X }
- X
- X--- 49,84 ----
- X
- X for (gatewalk = 0; gatewalk < possiblegates; gatewalk++)
- X {
- X! if (gatewalk < (mazewidth-1)/2) /* Pick a side: top? */
- X {
- X mazei = 0;
- X mazej = 2 * gatewalk + 1;
- X }
- X else
- X! if (gatewalk < ((mazewidth-1)/2 + (mazeheight-1)/2)) /* right? */
- X {
- X mazei = 2 * (gatewalk - (mazewidth-1)/2) + 1;
- X mazej = mazewidth-1;
- X }
- X else
- X! /*
- X! ** Thanks to Stefan M. Linnemann <crissl@rulcvx.LeidenUniv.nl> for picking
- X! ** up the two errors flagged beneath his user ID below, where I had "+ 1" and
- X! ** needed the "- 1"'s shown. Again, it dumped core on other machines, ran
- X! ** OK on mine. Sigh. Stefan was kind enough to send the repair back as a
- X! ** patch, and then to patiently explain to me in a second note _why_ what I
- X! ** did was wrong.
- X! */
- X! if (gatewalk < ((mazewidth-1) + (mazeheight-1)/2)) /* bottom? */
- X {
- X mazei = mazeheight-1;
- X! mazej = 2 * (((mazewidth-1)/2)- /* crissl */
- X! (gatewalk-((mazewidth-1)/2 + (mazeheight-1)/2))) - 1;
- X }
- X! else /* left! */
- X {
- X! mazei = 2 * (((mazeheight-1)/2)- /* crissl */
- X! (gatewalk-((mazewidth-1) + (mazeheight-1)/2))) - 1;
- X mazej = 0;
- X }
- X
- X*** makeunused.c.old Fri Apr 19 18:11:17 1991
- X--- makeunused.c Tue Apr 23 10:01:58 1991
- X***************
- X*** 58,185 ****
- X
- X tries++;
- X
- X! } while
- X! ( (tries <= MAXTRIES)
- X! && ( /* To avoid locking in an isolated room, check all 49 cells */
- X! /* centered on this cell, the hard way: no loop, no direct */
- X! /* index to the cells. Goal is to be able to run a street */
- X! /* on all four sides of the 3x3 cell array centered at this */
- X! /* cell. */
- X
- X! /* First verify cell and immediate neighbors two out all */
- X! /* have all their neighbors; if not, we're too close to a */
- X! /* border. */
- X
- X- (interiorcell(chosencell) != (1==1))
- X-
- X- || (interiorcell(nhbris(chosencell,0)) != (1==1))
- X- || (interiorcell(nhbris(nhbris(chosencell,0),0)) != (1==1))
- X- || (interiorcell(nhbris(chosencell,1)) != (1==1))
- X- || (interiorcell(nhbris(nhbris(chosencell,1),1)) != (1==1))
- X- || (interiorcell(nhbris(chosencell,2)) != (1==1))
- X- || (interiorcell(nhbris(nhbris(chosencell,2),2)) != (1==1))
- X- || (interiorcell(nhbris(chosencell,3)) != (1==1))
- X- || (interiorcell(nhbris(nhbris(chosencell,3),3)) != (1==1))
- X-
- X- /* Now check all 49 cells for ISOLATED status -- yeech! */
- X-
- X- /* check the chosen cell */
- X- || (statlist[chosencell].status != ISOLATED)
- X-
- X- /* check to the north/up */
- X- || (statlist[nhbris(chosencell,0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(chosencell,0),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 0),0),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 0),0),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 0),0),3),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 0),0),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 0),0),0),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 0),0),0),1),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 0),0),0),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 0),0),0),3),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 0),0),0),3),3),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(chosencell,0),3)].status != ISOLATED)
- X-
- X- /* check to the east/right */
- X- || (statlist[nhbris(chosencell,1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(chosencell,1),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(chosencell,1),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 1),1),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 1),1),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 1),1),0),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 1),1),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 1),1),1),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 1),1),1),2),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 1),1),1),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 1),1),1),0),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 1),1),1),0),0),0)].status != ISOLATED)
- X-
- X- /* check to the south/down */
- X- || (statlist[nhbris(chosencell,2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(chosencell,2),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(chosencell,2),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 2),2),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 2),2),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 2),2),1),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 2),2),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 2),2),2),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 2),2),2),3),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 2),2),2),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 2),2),2),1),1)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 2),2),2),1),1),1)].status != ISOLATED)
- X-
- X- /* check to the west/left */
- X- || (statlist[nhbris(chosencell,3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(chosencell,3),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(chosencell,3),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 3),3),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 3),3),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 3),3),2),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(chosencell,
- X- 3),3),3)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 3),3),3),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 3),3),3),0),0)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 3),3),3),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 3),3),3),2),2)].status != ISOLATED)
- X- || (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,
- X- 3),3),3),2),2),2)].status != ISOLATED)
- X- )
- X- );
- X-
- X if (tries <= MAXTRIES)
- X {
- X movefromto(&isolated,&isolatedct,&unused,&unusedct,UNUSED,chosencell);
- X--- 58,72 ----
- X
- X tries++;
- X
- X! /*
- X! ** Some C compilers couldn't cope with the big ugly while condition that used
- X! ** to be here, so it has become an internal routine called here. Thanks to
- X! ** dwade@jarthur.Claremont.edu and rmk@rmkhome.uucp (Rick Kelly) for reporting
- X! ** the problem.
- X! */
- X
- X! } while ((tries <= MAXTRIES) && wimpy_cc(chosencell));
- X
- X if (tries <= MAXTRIES)
- X {
- X movefromto(&isolated,&isolatedct,&unused,&unusedct,UNUSED,chosencell);
- X***************
- X*** 195,198 ****
- X--- 82,321 ----
- X }
- X }
- X return;
- X+ }
- X+
- X+ /*
- X+ ** Several compilers across the net died trying to digest what is now the
- X+ ** contents of this routine as a single statement. Sigh.
- X+ */
- X+
- X+ #ifdef __STDC__
- X+ int wimpy_cc(int chosencell)
- X+ #else
- X+ int wimpy_cc(chosencell)
- X+ int chosencell;
- X+ #endif
- X+
- X+ {
- X+
- X+ /*
- X+
- X+ To avoid locking in an isolated room, check all 49 cells centered on
- X+ this cell, the hard way: no loop, no direct index to the cells. Goal
- X+ is to be able to run a street on all four sides of the 3x3 cell array
- X+ centered at this cell.
- X+
- X+ First verify cell and immediate neighbors two out all have all their
- X+ neighbors; if not, we're too close to a border.
- X+
- X+ if (interiorcell(chosencell) != (1==1)) return((1==1));
- X+
- X+ if (interiorcell(nhbris(chosencell,0)) != (1==1)) return((1==1));
- X+
- X+ if (interiorcell(nhbris(nhbris(chosencell,0),0)) != (1==1)) return((1==1));
- X+
- X+ if (interiorcell(nhbris(chosencell,1)) != (1==1)) return((1==1));
- X+
- X+ if (interiorcell(nhbris(nhbris(chosencell,1),1)) != (1==1)) return((1==1));
- X+
- X+ if (interiorcell(nhbris(chosencell,2)) != (1==1)) return((1==1));
- X+
- X+ if (interiorcell(nhbris(nhbris(chosencell,2),2)) != (1==1)) return((1==1));
- X+
- X+ if (interiorcell(nhbris(chosencell,3)) != (1==1)) return((1==1));
- X+
- X+ if (interiorcell(nhbris(nhbris(chosencell,3),3)) != (1==1)) return((1==1));
- X+
- X+ /*
- X+ ** Now check all 49 cells for ISOLATED status -- yeech!
- X+ **
- X+ ** Check the chosen cell.
- X+ */
- X+
- X+ if (statlist[chosencell].status != ISOLATED) return((1==1));
- X+ /*
- X+ ** Check to the north/up.
- X+ */
- X+
- X+ if (statlist[nhbris(chosencell,0)].status != ISOLATED) return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(chosencell,0),0)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,0),0),1)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,0),0),3)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,0),0),3),3)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,0),0),0)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,0),0),0),1)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,0),0),0),1),1)
- X+ ].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,0),0),0),3)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,0),0),0),3),3)
- X+ ].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,0),0),
- X+ 0),3),3),3)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(chosencell,0),3)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ /*
- X+ ** Check to the east/right.
- X+ */
- X+
- X+ if (statlist[nhbris(chosencell,1)].status != ISOLATED) return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(chosencell,1),0)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(chosencell,1),1)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,1),1),2)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,1),1),0)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,1),1),0),0)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,1),1),1)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,1),1),1),2)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,1),1),1),2),2)
- X+ ].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,1),1),1),0)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,1),1),1),0),0)
- X+ ].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,1),1),
- X+ 1),0),0),0)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ /*
- X+ ** check to the south/down
- X+ */
- X+
- X+ if (statlist[nhbris(chosencell,2)].status != ISOLATED) return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(chosencell,2),1)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(chosencell,2),2)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,2),2),3)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,2),2),1)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,2),2),1),1)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,2),2),2)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,2),2),2),3)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,2),2),2),3),3)
- X+ ].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,2),2),2),1)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,2),2),2),1),1)
- X+ ].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,2),2),
- X+ 2),1),1),1)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ /*
- X+ ** check to the west/left
- X+ */
- X+
- X+ if (statlist[nhbris(chosencell,3)].status != ISOLATED) return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(chosencell,3),2)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(chosencell,3),3)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,3),3),0)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,3),3),2)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,3),3),2),2)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(chosencell,3),3),3)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,3),3),3),0)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,3),3),3),0),0)
- X+ ].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(chosencell,3),3),3),2)].status
- X+ != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,3),3),3),2),2)
- X+ ].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ if (statlist[nhbris(nhbris(nhbris(nhbris(nhbris(nhbris(chosencell,3),3),
- X+ 3),2),2),2)].status != ISOLATED)
- X+ return((1==1));
- X+
- X+ /*
- X+ ** Found no unisolated cell! Celebrate the good news.
- X+ */
- X+ return((1==0));
- X+
- X }
- X*** townmaze.test.old Fri Apr 19 22:33:09 1991
- X--- townmaze.test Tue Apr 23 09:55:22 1991
- X***************
- X*** 116,126 ****
- X echo ""
- X echo "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1'"
- X echo "Expected error: none -- should draw an 11 by 11 maze with 4 open gates"
- X! echo "but no courtyard because the gates get in the way"
- X townmaze -h 11 -w 11 -g 4 -l 4 -c 1
- X echo "Executing 'townmaze -h 11 -w 11 -g 0 -l 0 -c 1'"
- X! echo "Expected error: none -- should draw an 11 by 11 maze with no gates"
- X! echo "but one courtyard (which should mean no center room"
- X townmaze -h 11 -w 11 -g 0 -l 0 -c 1
- X echo ""
- X echo "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1 junk trash'"
- X--- 116,126 ----
- X echo ""
- X echo "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1'"
- X echo "Expected error: none -- should draw an 11 by 11 maze with 4 open gates"
- X! echo "but no courtyard (so a busier center) because the gates get in the way"
- X townmaze -h 11 -w 11 -g 4 -l 4 -c 1
- X echo "Executing 'townmaze -h 11 -w 11 -g 0 -l 0 -c 1'"
- X! echo "Expected error: none -- should draw an 11 by 11 maze with no gates but"
- X! echo "one courtyard opening the center (which usually means no center room)"
- X townmaze -h 11 -w 11 -g 0 -l 0 -c 1
- X echo ""
- X echo "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1 junk trash'"
- X*** townpgmr.doc.old Sat Apr 20 00:16:48 1991
- X--- townpgmr.doc Tue Apr 23 07:48:16 1991
- X***************
- X*** 693,709 ****
- X cell choice to try, and a bump of tries to check each round against
- X MAXTRIES.
- X
- X! The scary looking part is the 59 guard conditions on those two
- X! statements, perhaps some minor record. Dijkstra would be proud. There
- X! is really a lot less than meets the eye. First, the tries against
- X! MAXTRIES test is done. Next, enough interiorcell() checks are done to
- X! assure that all 49 cells exist, each check depending on some one
- X! before for the existance of the next cell to check. Last, all 49
- X cells are checked to be ISOLATED cells. The thing that makes it look
- X messy is that the nbhris() method of finding a neighbor is used rather
- X than defining several extra functions to accomplish the same thing
- X! with fewer lines of code. Again, mainly defended by this being a low
- X! cpu cost part of the code.
- X
- X -----------------------------------------------------------------------
- X | movefromto.c -- movefromto(&fromlist,&fromcount,&tolist,&tocount,
- X--- 693,715 ----
- X cell choice to try, and a bump of tries to check each round against
- X MAXTRIES.
- X
- X! What was a set of guard conditions for the do{}while is now a separate
- X! routine, to allow smaller compilers to compile the code.
- X!
- X! The new routine wimpy_cc() does 59 guard conditions for the do{}while,
- X! perhaps some minor record. Dijkstra would be proud. There is really a
- X! lot less than meets the eye. First, the tries against MAXTRIES test
- X! is done in the do{}while condition.
- X!
- X! Next, wimpy_cc() is called. There, enough interiorcell() checks are
- X! done to assure that all 49 cells exist, each check depending on some
- X! one before for the existance of the next cell to check. Last, all 49
- X cells are checked to be ISOLATED cells. The thing that makes it look
- X messy is that the nbhris() method of finding a neighbor is used rather
- X than defining several extra functions to accomplish the same thing
- X! with fewer lines of code.
- X!
- X! Again, mainly defended by this being a low cpu cost part of the code.
- X
- X -----------------------------------------------------------------------
- X | movefromto.c -- movefromto(&fromlist,&fromcount,&tolist,&tocount,
- END_OF_FILE
- if test 22788 -ne `wc -c <'patch02'`; then
- echo shar: \"'patch02'\" unpacked with wrong size!
- fi
- # end of 'patch02'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-