townmaze, patch 1

Kent Paul Dolan xanthian at zorch.SF-Bay.ORG
Sun Apr 21 12:50:12 AEST 1991


Archive-name: townmaze/patch01

Well, one pretty serious bug report for a bug that should have killed
the program on both systems where I tested it, but mysteriously didn't,
bounced back in a day, thanks to Glenn Host, whose system upchucked
immediately when presented the code. Typical 3AM coding error, fixed
now.

He also sent along some unfinished but clever interface error reporting
improvements for getargs() that I scavanged and included, and that
motivated me to do more of my own; the program now does a little more
than just blast a usage message at you for bad parameters; it tells you
why what you did is wrong.

I also improved the logic a bit for UNUSED cells in makestreet.c; LIVE
cells are no longer created beside interior UNUSED cells.

Some of the arithmetic for how many things would fit, in getargs(), was
wrong but hidden by MAXTRIES from infinite loop failures doing cell
placement; it's at least closer now.

Various other minor stuff is listed in the CHANGES file, and there is a
new test script townmaze.test for proving out the error reporting, if
anyone's interested.  It showed me the getargs.c errors.

To install the patches, unpack this archive in the directory where you
have the townmaze source code, and then say "patch < patch01" and magic
should happen.  You then need to remake the software.

I tested this archive and patch on my BSD 4.3 system; if you're using
something else, good luck!

Enjoy, and let me know if you're having fun with townmaze, or find some
improvements.

Kent, the man from xanth.
<xanthian at Zorch.SF-Bay.ORG> <xanthian at 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:  CHANGES MANIFESTp1.1 patch01 patchlevel.h townmaze.test
# Wrapped by xanthian at zorch on Sat Apr 20 00:44:13 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'CHANGES' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'CHANGES'\"
else
echo shar: Extracting \"'CHANGES'\" \(1684 characters\)
sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
XCHANGES -- change record for townmaze
X
Xv 1.1 20 April 1991
X
XCHANGES
X
X  Added this file.
X
Xpatchlevel.h 
X
X  Added, set at patchlevel 1.
X
Xtownmaze.test
X
X  Added a script file that tests all the error returns from getargs().
X
Xmakespace.c 
X
X  Fixed a horrid bug that should have dumped core in testing, and did show
X  problems for Glenn E. Host.  When creating space for cmaze[][], I was
X  allocating "mazeheight" char * pointer slots, but then using "mazewidth"
X  of them to hold the pointers, by using a bad loop limit,  Sigh.  Worked
X  perfectly fine on my two brain damaged machines.  Thanks, Glenn.
X
Xgetarg.c 
X
X  Added errctr and quit_reasons[] code to give exit reasons when a bad
X  parameter is read, inspired by and mostly using unfinished code forwarded
X  by Glenn E. Host.  Thanks, Glenn!
X
X  Thus inspired, improved interface for reporting other bad parameter
X  conditions,
X
X  Reordered switch checks to correspond with usage.c parameter order.
X
X  Added missing guard against negative -u (unused cell) parameter.
X
X  Fixed incomplete test for sscanf() return values to test against 0 as
X  well as EOF.
X
X  Fixed bad math in unused cell fit test and gate fit test.  Sigh.
X
Xmakestreet.c
X
X  Added check to assure that a LIVE cell is never created as neighbor to
X  an UNUSED cell. Since no STREET cell can ever be a neighbor of an UNUSED
X  cell, the cell should not be LIVE and thus eligible for use in phase one
X  of connectstreets().  Now they get changed from ISOLATED and remain DEAD.
X
Xtownpgmr.doc
X
X  Updated to reflect changes in .c files
X
Xtownuser.doc
X
X  Updated to reflect improved interface.
X
XREADME
X
X  Updated to describe townmaze.test.
X
Xv 1.0 18 April 1991 Original Release
END_OF_FILE
if test 1684 -ne `wc -c <'CHANGES'`; then
    echo shar: \"'CHANGES'\" unpacked with wrong size!
fi
# end of 'CHANGES'
fi
if test -f 'MANIFESTp1.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFESTp1.1'\"
else
echo shar: Extracting \"'MANIFESTp1.1'\" \(269 characters\)
sed "s/^X//" >'MANIFESTp1.1' <<'END_OF_FILE'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X CHANGES                    1	
X MANIFESTp1.1               1	This shipping list
X patch01                    1	
X patchlevel.h               1	
X townmaze.test              1	
END_OF_FILE
if test 269 -ne `wc -c <'MANIFESTp1.1'`; then
    echo shar: \"'MANIFESTp1.1'\" unpacked with wrong size!
fi
# end of 'MANIFESTp1.1'
fi
if test -f 'patch01' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patch01'\"
else
echo shar: Extracting \"'patch01'\" \(18139 characters\)
sed "s/^X//" >'patch01' <<'END_OF_FILE'
XThis says there should be a patchlevel.h file containing a 0; it should
Xunpack with the shar containing this patch.  It will be updated to be
Xpatchlevel 1 by this patch.  Kent.
X
XPrereq: 0
X
X*** patchlevel.h.old	Sat Apr 20 00:24:56 1991
X--- patchlevel.h	Sat Apr 20 00:25:47 1991
X***************
X*** 1 ****
X! #define patchlevel 0
X--- 1 ----
X! #define patchlevel 1
X*** README.old	Fri Apr 19 23:48:02 1991
X--- README	Sat Apr 20 00:19:09 1991
X***************
X*** 1,4 ****
X! Townmaze -- A Program to Design "Bard's Tale I"-Style City Mazes
X  
X  Copyright 1991 by Kent Paul Dolan, Mountain View, CA, USA 94039-0755
X  
X--- 1,4 ----
X! Townmaze v1.1 -- A Program to Design "Bard's Tale I"-Style City Mazes
X  
X  Copyright 1991 by Kent Paul Dolan, Mountain View, CA, USA 94039-0755
X  
X***************
X*** 71,76 ****
X--- 71,81 ----
X  display.  You may also want to read the townuser.doc and townpgmr.doc
X  files for more information about the program for users and programmers
X  respectively.
X+ 
X+ File CHANGES documents the running changes from release to release, and
X+ file townmaze.test will do a complete test of the user interface code;
X+ when you see how big script townmaze.test is, you'll know why providing
X+ a script was a friendly gesture.
X  
X  Any non-commercial use of this code is permitted, in whole or in part;
X  credit to the author is requested but not demanded. Commercial use may
X*** getargs.c.old	Fri Apr 19 18:13:35 1991
X--- getargs.c	Fri Apr 19 22:18:55 1991
X***************
X*** 21,28 ****
X--- 21,59 ----
X    char *argv[];
X  #endif
X  {
X+   int scantemp;
X    int i;
X  
X+ /*
X+ ** The next two data items and the code at the bottom to use them are
X+ ** adapted, and mostly stolen wholesale and reformatted, from suggestions
X+ ** submitted by "GLENN E. HOST" <host at ccf4.nrl.navy.mil> along with a
X+ ** very prompt bug report.  Besides, his changes made me go back and look
X+ ** harder at this interface; I hope this error reporting is more useful.
X+ ** Thanks, Glenn!
X+ */
X+ 
X+   int errctr;
X+ 
X+   static char *quit_messages[] =
X+   {
X+     " (-h): Maze height must be 11 or greater",
X+     " (-h): Maze height must be an odd number",
X+     " (-w): Maze width must be 11 or greater",
X+     " (-w): Maze width must be an odd number",
X+     " (-g): Maze gates must be a non-negative number",
X+     " (-g): Too many maze gates to fit",
X+     " (-l): Gates left must be a non-negative number",
X+     "s: Gates left (-l) must be no greater than gates at start (-g)",
X+     " (-c): Maze courts must be a non-negative number",
X+     " (-c): Too many maze courts to fit",
X+     "s: At least one court (-c) or one gate (-g) must exist",
X+     " (-u): Maze unused must be a non-negative number",
X+     " (-u): Too many unused cells to fit",
X+     " (-s): Straightness must be a non-negative number",
X+     " (-s): Straightness must be less than 999"
X+   };
X+ 
X  #if PROGRESS
X    fprintf(stderr,"Get arguments ");
X  #endif
X***************
X*** 31,36 ****
X--- 62,68 ----
X    {
X      if ((argc%2) != 1)
X      {
X+       fprintf(stderr,"\n*** Parameters must come in flag/value pairs\n\n");
X        usage();
X        exit(1);
X      }
X***************
X*** 39,44 ****
X--- 71,79 ----
X      {
X        if ((*argv[i]) != '-')
X        {
X+         fprintf(stderr,
X+           "\n*** Expected flag, didn't see '-' for argument %d\n\n",i);
X+    
X          usage();
X          exit(1);
X        }
X***************
X*** 45,52 ****
X        switch (*(argv[i]+1))
X        {
X        case 'h':
X!         if (sscanf(argv[i+1],"%d",&mazeheight) == EOF)
X          {
X            usage();
X            exit(1);
X          }
X--- 80,89 ----
X        switch (*(argv[i]+1))
X        {
X        case 'h':
X!         if (   ((scantemp = sscanf(argv[i+1],"%d",&mazeheight)) == EOF)
X!             || (scantemp == 0))
X          {
X+           fprintf(stderr,"\n*** Unable to read value after '-h'\n\n");
X            usage();
X            exit(1);
X          }
X***************
X*** 53,112 ****
X          break;
X  
X        case 'w':
X!         if (sscanf(argv[i+1],"%d",&mazewidth) == EOF)
X          {
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 'r':
X!         if (sscanf(argv[i+1],"%ld",&randomseed) == EOF)
X          {
X            usage();
X            exit(1);
X          }
X-         SEEDRANDOM(randomseed); /* override clock seed in main() */
X          break;
X  
X!       case 'g':
X!         if (sscanf(argv[i+1],"%d",&mazegates) == EOF)
X          {
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 'l':
X!         if (sscanf(argv[i+1],"%d",&leftgates) == EOF)
X          {
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 'c':
X!         if (sscanf(argv[i+1],"%d",&mazecourts) == EOF)
X          {
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 'u':
X!         if (sscanf(argv[i+1],"%d",&mazeunused) == EOF)
X          {
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 's':
X!         if (sscanf(argv[i+1],"%d",&mazestraightness) == EOF)
X          {
X            usage();
X            exit(1);
X          }
X          break;
X  
X        default:
X--- 90,163 ----
X          break;
X  
X        case 'w':
X!         if (   ((scantemp = sscanf(argv[i+1],"%d",&mazewidth)) == EOF)
X!             || (scantemp == 0))
X          {
X+           fprintf(stderr,"\n*** Unable to read value after '-w'\n\n");
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 'g':
X!         if (   ((scantemp = sscanf(argv[i+1],"%d",&mazegates)) == EOF)
X!             || (scantemp == 0))
X          {
X+           fprintf(stderr,"\n*** Unable to read value after '-g'\n\n");
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 'l':
X!         if (   ((scantemp = sscanf(argv[i+1],"%d",&leftgates)) == EOF)
X!             || (scantemp == 0))
X          {
X+           fprintf(stderr,"\n*** Unable to read value after '-l'\n\n");
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 'c':
X!         if (   ((scantemp = sscanf(argv[i+1],"%d",&mazecourts)) == EOF)
X!             || (scantemp == 0))
X          {
X+           fprintf(stderr,"\n*** Unable to read value after '-c'\n\n");
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 'u':
X!         if (   ((scantemp = sscanf(argv[i+1],"%d",&mazeunused)) == EOF)
X!             || (scantemp == 0))
X          {
X+           fprintf(stderr,"\n*** Unable to read value after '-u'\n\n");
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 's':
X!         if (   ((scantemp = sscanf(argv[i+1],"%d",&mazestraightness)) == EOF)
X!             || (scantemp == 0))
X          {
X+           fprintf(stderr,"\n*** Unable to read value after '-s'\n\n");
X            usage();
X            exit(1);
X          }
X          break;
X  
X!       case 'r':
X!         if (   ((scantemp = sscanf(argv[i+1],"%ld",&randomseed)) == EOF)
X!             || (scantemp == 0))
X          {
X+           fprintf(stderr,"\n*** Unable to read value after '-r'\n\n");
X            usage();
X            exit(1);
X          }
X+         SEEDRANDOM(randomseed); /* override clock seed in main() */
X          break;
X  
X        default:
X***************
X*** 116,137 ****
X        i += 2;
X      }
X    }
X!   if (   ((mazewidth%2) != 1)
X!       || ((mazeheight%2) != 1)
X!       || (mazewidth < 11)
X!       || (mazeheight < 11)
X!       || (mazegates < 0)
X!       || (mazegates > (2*((mazeheight - 6)/7) + 2*((mazewidth- 6)/7)))
X!       || (leftgates < 0)
X!       || (leftgates > mazegates)
X!       || (mazecourts < 0)
X!       || (mazecourts > (((mazeheight - 5)/6)*((mazewidth - 5)/6)))
X!       || ((mazecourts + mazegates) < 1)
X!       || (mazeunused > (((mazeheight - 1)/14)*((mazewidth - 1)/14)))
X!       || (mazestraightness < 0)
X!       || (mazestraightness > 998)
X       )
X    {
X      usage();
X      exit(1);
X    }
X--- 167,204 ----
X        i += 2;
X      }
X    }
X! /*
X! ** Thanks to "GLENN E. HOST" <host at ccf4.nrl.navy.mil> for the idea, and
X! ** most of the new code here, to dump out the reason a command line
X! ** failed when it does. The functionality was pretty obviously needed
X! ** with this many parameters and ways to fail.  Don't blame Glenn for the
X! ** way the code looks now, it's back in what he called my "interesting
X! ** coding style".
X! */
X!   if (   (errctr=0, mazeheight < 11)
X!       || (errctr++, (mazeheight%2) != 1)
X!       || (errctr++, mazewidth < 11)
X!       || (errctr++, (mazewidth%2) != 1)
X!       || (errctr++, mazegates < 0)
X!       || (errctr++, mazegates > (  2*((mazeheight - 5)/6)
X!                                  + 2*((mazewidth - 5)/6)))
X!       || (errctr++, leftgates < 0)
X!       || (errctr++, leftgates > mazegates)
X!       || (errctr++, mazecourts < 0)
X!       || (errctr++, mazecourts > (((mazeheight - 5)/6)*((mazewidth - 5)/6)))
X!       || (errctr++, (mazecourts + mazegates) < 1)
X!       || (errctr++, mazeunused < 0)
X!       || (errctr++, mazeunused > (((mazeheight - 5)/14)*((mazewidth - 5)/14)))
X!       || (errctr++, mazestraightness < 0)
X!       || (errctr++, mazestraightness > 998)
X       )
X    {
X+     fprintf(stderr,"\n*** Bad argument%s. You said:\n\n",
X+                    quit_messages[errctr]);
X+     fprintf(stderr,"ht %d wd %d gates %d left %d courts %d",
X+                     mazeheight,mazewidth,mazegates,leftgates,mazecourts);
X+     fprintf(stderr," unused %d straight %d seed %ld\n\n",
X+                    mazeunused, mazestraightness,randomseed);
X      usage();
X      exit(1);
X    }
X*** makespace.c.old	Fri Apr 19 18:12:19 1991
X--- makespace.c	Fri Apr 19 18:21:11 1991
X***************
X*** 41,47 ****
X      exit(1);
X    }
X  
X!   for (i = 0; i < mazewidth; i++)
X    {
X      if ((cmaze[i] = (char *)malloc(mazewidth * sizeof(char))) == NULL)
X      {
X--- 41,53 ----
X      exit(1);
X    }
X  
X! /*
X! ** Thanks to  "GLENN E. HOST" <host at ccf4.nrl.navy.mil> for spotting a bug
X! ** here that should have killed something during testing; I had mazewidth
X! ** for mazeheight in the loop limit here.
X! */
X! 
X!   for (i = 0; i < mazeheight; i++)
X    {
X      if ((cmaze[i] = (char *)malloc(mazewidth * sizeof(char))) == NULL)
X      {
X*** makestreet.c.old	Fri Apr 19 22:48:48 1991
X--- makestreet.c	Fri Apr 19 22:54:42 1991
X***************
X*** 211,218 ****
X  /*
X  ** Only let an isolated cell become live if it is interior; stops
X  ** streets from running along the city wall, creating lots of gates.
X  */
X!       if (interiorcell(nhbris(chosencell,nhbrid)))
X          for (nextnhbrid = 0; nextnhbrid < 4; nextnhbrid++)
X            if (nhbrexists(nhbris(chosencell,nhbrid),nextnhbrid))
X              if (statlist[nhbris(nhbris(chosencell,nhbrid),nextnhbrid)].status
X--- 211,225 ----
X  /*
X  ** Only let an isolated cell become live if it is interior; stops
X  ** streets from running along the city wall, creating lots of gates.
X+ ** Don't make it live if it is next to an unused cell, either, since
X+ ** it can never become a street cell.
X  */
X!       if (   interiorcell(nhbris(chosencell,nhbrid))
X!           && (statlist[nhbris(nhbris(chosencell,nhbrid),0)].status != UNUSED)
X!           && (statlist[nhbris(nhbris(chosencell,nhbrid),1)].status != UNUSED)
X!           && (statlist[nhbris(nhbris(chosencell,nhbrid),2)].status != UNUSED)
X!           && (statlist[nhbris(nhbris(chosencell,nhbrid),3)].status != UNUSED)
X!          )
X          for (nextnhbrid = 0; nextnhbrid < 4; nextnhbrid++)
X            if (nhbrexists(nhbris(chosencell,nhbrid),nextnhbrid))
X              if (statlist[nhbris(nhbris(chosencell,nhbrid),nextnhbrid)].status
X*** townpgmr.doc.old	Fri Apr 19 22:55:34 1991
X--- townpgmr.doc	Sat Apr 20 00:16:48 1991
X***************
X*** 1,4 ****
X! File townpgmr.doc, the programmers' documentation for townmaze.
X  
X  
X  This file documents the C code; see file README for compile and
X--- 1,4 ----
X! File townpgmr.doc, the programmers' documentation for townmaze Release 1.1.
X  
X  
X  This file documents the C code; see file README for compile and
X***************
X*** 387,393 ****
X  
X  
X  -----------------------------------------------------------------------
X! | getargs.c
X  -----------------------------------------------------------------------
X  
X  This routine accomplishes step 1) above.  Sigh again.  Lattice C for
X--- 387,393 ----
X  
X  
X  -----------------------------------------------------------------------
X! | getargs.c -- getargs(argc,argv)
X  -----------------------------------------------------------------------
X  
X  This routine accomplishes step 1) above.  Sigh again.  Lattice C for
X***************
X*** 416,422 ****
X  The check below the switch is about half of the sanity in the whole
X  program:
X  
X! ((mazewidth%2) != 1) -- The maze width must be odd.
X  
X  ((mazeheight%2) != 1) -- The maze height must be odd.
X  
X--- 416,423 ----
X  The check below the switch is about half of the sanity in the whole
X  program:
X  
X! (mazeheight < 11) -- The maze must be at least five cells wide to
X! leave room for one interior row of buildings. 
X  
X  ((mazeheight%2) != 1) -- The maze height must be odd.
X  
X***************
X*** 423,431 ****
X  (mazewidth < 11) -- The maze must be at least five cells high to leave
X  room for one interior row of buildings. 
X  
X! (mazeheight < 11) -- The maze must be at least five cells wide to
X! leave room for one interior row of buildings. 
X  
X  (mazegates < 0) -- There must be at least zero gates.
X  
X  (mazegates > (2*((mazeheight - 6)/7) + 2*((mazewidth- 6)/7))) -- There
X--- 424,435 ----
X  (mazewidth < 11) -- The maze must be at least five cells high to leave
X  room for one interior row of buildings. 
X  
X! ((mazewidth%2) != 1) -- The maze width must be odd.
X  
X+ The above four checks are order sensitive in the error messages they
X+ produce, because C (at least the ones I have here) implements modulus
X+ of a negative number wrong, so that ((-1)%2 != 1) comes out true.
X+ 
X  (mazegates < 0) -- There must be at least zero gates.
X  
X  (mazegates > (2*((mazeheight - 6)/7) + 2*((mazewidth- 6)/7))) -- There
X***************
X*** 445,450 ****
X--- 449,456 ----
X  
X  ((mazecourts + mazegates) < 1) -- There must be at least one street.
X  
X+ (mazeunused < 0) -- There must be at least zero unused cells.
X+ 
X  (mazeunused > (((mazeheight - 1)/14)*((mazewidth - 1)/14))) -- Unused
X  cells must have room for at least three squares between them,
X  otherwise they can trap DEAD cells away from streets and won't fit when
X***************
X*** 458,463 ****
X--- 464,478 ----
X  occur. 999 is the highest value returned by the random roll modded
X  against 1000, so 998 is the largest accpetable straightness parameter. 
X  
X+ The above checks now bump an error counter, and if the sanity check
X+ drops out for any reason, an appropriate message telling which parameter
X+ was wrong, and why, is printed. Since the values read in OK, but were
X+ just inappropriate, the header line optional below to stdout is forced
X+ here to stderr to show the user what the program thinks s/he said.
X+ 
X+ Similar error reporting is now in the switch statement cases for
X+ unreadable parameters.
X+ 
X  If all the parameters are right, the listsize (number of cell
X  structures in statlist) is computed from the requested maze width and
X  height. If the HEADER option is on (I always use it) a single line of
X***************
X*** 465,470 ****
X--- 480,487 ----
X  [All other output goes to the standard error unit.]
X  
X  
X+ 
X+ 
X  -----------------------------------------------------------------------
X  | interiorcell.c -- interiorcell(cellid)
X  -----------------------------------------------------------------------
X***************
X*** 598,604 ****
X  enough to see that it was the last big logic bug in the program.  If
X  the neighbor is ISOLATED, it becomes LIVE or DEAD, as appropriate,
X  except that border cells always become dead to keep the roads off the
X! walls as mentioned previously. 
X  
X  This change, however, might mean that the formerly ISOLATED cells LIVE
X  neighbors, if any, no longer qualify as LIVE.  So, each of those
X--- 615,623 ----
X  enough to see that it was the last big logic bug in the program.  If
X  the neighbor is ISOLATED, it becomes LIVE or DEAD, as appropriate,
X  except that border cells always become dead to keep the roads off the
X! walls as mentioned previously, and neighbors of UNUSED cells never
X! become LIVE (because they aren't eligible to become streets), but
X! always go from ISOLATED to DEAD. 
X  
X  This change, however, might mean that the formerly ISOLATED cells LIVE
X  neighbors, if any, no longer qualify as LIVE.  So, each of those
X*** townuser.doc.old	Fri Apr 19 23:48:44 1991
X--- townuser.doc	Sat Apr 20 00:16:16 1991
X***************
X*** 1,9 ****
X! Welcome, as it were, to townmaze.
X  
X  Just typing "townmaze" at the command line will do an example maze for
X  you, once the program has been compiled and installed (see README).
X  
X! Typing "townmaze help" at the command line will get you a "usage"
X  display about 22 lines high, describing each of the parameters and
X  their limits.
X  
X--- 1,10 ----
X! Welcome, as it were, to townmaze release 1.1.
X  
X  Just typing "townmaze" at the command line will do an example maze for
X  you, once the program has been compiled and installed (see README).
X  
X! Typing "townmaze help" at the command line will get you an error
X! message (Read it fast on a 25 line screen!) and then a  "usage"
X  display about 22 lines high, describing each of the parameters and
X  their limits.
X  
X***************
X*** 168,173 ****
X--- 169,181 ----
X  you install the software in a computer game, to be able to use a level
X  over and over without having to store its design explicitly in the
X  game. 
X+ 
X+ As of release 1.1, townmaze does lots of error reporting on parameter
X+ entry, before dumping the usage display. There is a file called
X+ townmaze.test (a csh or AmigaOS script) which will test every error
X+ message from the parameter reading routine. It's kind of tedious, but
X+ you might want to run it once to make sure your installation is working
X+ as it was intended to do.
X  
X  I hope you have fun with my toy.
X  
END_OF_FILE
if test 18139 -ne `wc -c <'patch01'`; then
    echo shar: \"'patch01'\" unpacked with wrong size!
fi
# end of 'patch01'
fi
if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patchlevel.h'\"
else
echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
X#define patchlevel 0
END_OF_FILE
if test 21 -ne `wc -c <'patchlevel.h'`; then
    echo shar: \"'patchlevel.h'\" unpacked with wrong size!
fi
# end of 'patchlevel.h'
fi
if test -f 'townmaze.test' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'townmaze.test'\"
else
echo shar: Extracting \"'townmaze.test'\" \(6718 characters\)
sed "s/^X//" >'townmaze.test' <<'END_OF_FILE'
X#/bin/csh
X#
X# townmaze.test
X#
X# Here is a thorough test of the townmaze interface error returns
X#
Xecho ""
Xecho "Executing 'townmaze junk'"
Xecho "Expected error: unpaired argument error"
Xtownmaze junk 
Xecho ""
Xecho "Executing 'townmaze junk trash'"
Xecho "Expected error: non-flag parameter"
Xtownmaze junk trash
Xecho ""
Xecho "Executing 'townmaze -h junk'"
Xecho "Expected error: unreadable -h value"
Xtownmaze -h junk 
Xecho ""
Xecho "Executing 'townmaze -h -1'"
Xecho "Expected error: -h value too small"
Xtownmaze -h -1 
Xecho ""
Xecho "Executing 'townmaze -h  3'"
Xecho "Expected error: -h value too small"
Xtownmaze -h  3 
Xecho ""
Xecho "Executing 'townmaze -h 12'"
Xecho "Expected error: -h value not odd"
Xtownmaze -h 12 
Xecho ""
Xecho "Executing 'townmaze -h 11'"
Xecho "Expected error: none -- should make an 11 x 77 maze"
Xtownmaze -h 11 
Xecho ""
Xecho "Executing 'townmaze -h 11 junk trash'"
Xecho "Expected error: non-flag parameter"
Xtownmaze -h 11 junk trash 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w junk'"
Xecho "Expected error: unreadable -w value"
Xtownmaze -h 11 -w junk 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w -1'"
Xecho "Expected error: -w value too small"
Xtownmaze -h 11 -w -1 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 3'"
Xecho "Expected error: -w value too small"
Xtownmaze -h 11 -w 3 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 12'"
Xecho "Expected error: -w value not odd"
Xtownmaze -h 11 -w 12 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 junk trash'"
Xecho "Expected error: non-flag-parameter"
Xtownmaze -h 11 -w 11 junk trash 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11'"
Xecho "Expected error: none -- should make an 11 x 11 maze"
Xtownmaze -h 11 -w 11 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g junk'"
Xecho "Expected error: unreadable -g value"
Xtownmaze -h 11 -w 11 -g junk 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g -1'"
Xecho "Expected error: negative -g value"
Xtownmaze -h 11 -w 11 -g -1 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 5'"
Xecho "Expected error: gates won't fit"
Xtownmaze -h 11 -w 11 -g 5 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4'"
Xecho "Expected error: none -- should make an 11 by 11 maze with 4 gates,"
Xecho " 2 of them left open"
Xtownmaze -h 11 -w 11 -g 4 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 junk trash'"
Xecho "Expected error: non-flag parameter"
Xtownmaze -h 11 -w 11 -g 4 junk trash 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l junk'"
Xecho "Expected error: unreadable -l value"
Xtownmaze -h 11 -w 11 -g 4 -l junk 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l -1'"
Xecho "Expected error: negative -l value"
Xtownmaze -h 11 -w 11 -g 4 -l -1 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 5'"
Xecho "Expected error: more gates left than started"
Xtownmaze -h 11 -w 11 -g 4 -l 5 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4'"
Xecho "Expected error: none -- should draw a maze with 4 open gates"
Xtownmaze -h 11 -w 11 -g 4 -l 4 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 junk trash'"
Xecho "Expected error: non-flag parameter"
Xtownmaze -h 11 -w 11 -g 4 -l 4 junk trash 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c junk'"
Xecho "Expected error: unreadable -c parameter"
Xtownmaze -h 11 -w 11 -g 4 -l 4 -c junk 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c -1'"
Xecho "Expected error: negative -c parameter"
Xtownmaze -h 11 -w 11 -g 4 -l 4 -c -1 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 2'"
Xecho "Expected error: courts won't fit"
Xtownmaze -h 11 -w 11 -g 4 -l 4 -c 2 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1'"
Xecho "Expected error: none -- should draw an 11 by 11 maze with 4 open gates"
Xecho "but no courtyard because the gates get in the way"
Xtownmaze -h 11 -w 11 -g 4 -l 4 -c 1 
Xecho "Executing 'townmaze -h 11 -w 11 -g 0 -l 0 -c 1'"
Xecho "Expected error: none -- should draw an 11 by 11 maze with no gates"
Xecho "but one courtyard (which should mean no center room"
Xtownmaze -h 11 -w 11 -g 0 -l 0 -c 1 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1 junk trash'"
Xecho "Expected error: non-flag parameter"
Xtownmaze -h 11 -w 11 -g 4 -l 4 -c 1 junk trash 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1 -u junk'"
Xecho "Expected error: unreadable -u parameter"
Xtownmaze -h 11 -w 11 -g 4 -l 4 -c 1 -u junk 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1 -u -1'"
Xecho "Expected error: negative -u parameter"
Xtownmaze -h 11 -w 11 -g 4 -l 4 -c 1 -u -1 
Xecho ""
Xecho "Executing 'townmaze -h 11 -w 11 -g 4 -l 4 -c 1 -u 1'"
Xecho "Expected error: unused cells won't fit"
Xtownmaze -h 11 -w 11 -g 4 -l 4 -c 1 -u 1 
Xecho ""
Xecho "Executing 'townmaze -h 19 -w 19 -g 4 -l 4 -c 1 -u 1'"
Xecho "Expected error: none -- should draw a 19 by 19 maze with no unused"
Xecho "center cell because the gates interfere. The courtyard may appear,"
Xecho "but may be hard to spot"
Xtownmaze -h 19 -w 19 -g 4 -l 4 -c 1 -u 1
Xecho ""
Xecho "Executing 'townmaze -h 19 -w 19 -g 0 -l 0 -c 1 -u 1'"
Xecho "Expected error: none -- should draw a 19 by 19 maze with no gates,"
Xecho "an unused center cell, but the courtyard should not appear"
Xtownmaze -h 19 -w 19 -g 0 -l 0 -c 1 -u 1 
Xecho ""
Xecho "Executing 'townmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 junk trash'"
Xecho "Expected error: non-flag parameter"
Xtownmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 junk trash 
Xecho ""
Xecho "Executing 'townmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s junk'"
Xecho "Expected error: unreadable -s parameter"
Xtownmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s junk 
Xecho ""
Xecho "Executing 'townmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s -1'"
Xecho "Expected error: negative -s parameter"
Xtownmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s -1 
Xecho ""
Xecho "Executing 'townmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 999'"
Xecho "Expected error: -s parameter over 998"
Xtownmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 999 
Xecho ""
Xecho "Executing 'townmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 998'"
Xecho "Expected error: none should draw a very straight 21 by 21 maze with"
Xecho "four open gates, an unused center cell, but no courtyard"
Xtownmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 998 
Xecho ""
Xecho "Executing 'townmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 998 junk trash'"
Xecho "Expected error: non-flag parameter"
Xtownmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 998 junk trash 
Xecho ""
Xecho "Executing 'townmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 998 -r junk'"
Xecho "Expected error: unreadable -r parameter"
Xtownmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 998 -r junk 
Xecho ""
Xecho "Executing 'townmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 998 -r 12345'"
Xecho "Expected error: none -- should draw a maze with a forced random"
Xecho "number seed"
Xtownmaze -h 21 -w 21 -g 4 -l 4 -c 1 -u 1 -s 998 -r 12345 
END_OF_FILE
if test 6718 -ne `wc -c <'townmaze.test'`; then
    echo shar: \"'townmaze.test'\" unpacked with wrong size!
fi
chmod +x 'townmaze.test'
# end of 'townmaze.test'
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



More information about the Alt.sources mailing list