home *** CD-ROM | disk | FTP | other *** search
- /*
- ** showdbmaze.c Copyright 1991 Kent Paul Dolan,
- ** Mountain View, CA, USA 94039-0755
- **
- ** Written to satisfy an inquiry on USENet's rec.games.programmer newsgroup.
- ** May be freely used or modified in any non-commercial work. Copyrighted
- ** only to prevent patenting by someone else.
- */
-
- #include <stdio.h>
- #include "townmaze.h"
- #include "townproto.h"
-
- #ifdef __STDC__
- void showdebugmaze()
- #else
- int showdebugmaze()
- #endif
- {
- int i, j, cellid;
-
- /*
- ** Draw the character version of the maze to stdout.
- */
-
- fprintf(stdout,"\n");
- for (i = 0; i < mazeheight; i++)
- {
- for (j = 0; j < mazewidth; j++)
- if (((i%2)==1)&&((j%2)==1))
- {
- cellid = (i/2)*(mazewidth/2)+(j/2);
- switch (statlist[cellid].status)
- {
- case ISOLATED:
- fprintf(stdout,"%c",'I');
- break;
- case LIVE:
- fprintf(stdout,"%c",'L');
- break;
- case DEAD:
- fprintf(stdout,"%c",'D');
- break;
- case STREET:
- switch (statlist[cellid].streetdir)
- {
- case -1:
- fprintf(stdout,"%c",BLANK);
- break;
- case 0:
- fprintf(stdout,"%c",'^');
- break;
- case 1:
- fprintf(stdout,"%c",'>');
- break;
- case 2:
- fprintf(stdout,"%c",'v');
- break;
- case 3:
- fprintf(stdout,"%c",'<');
- break;
- default:
- fprintf(stdout,"%c",'X');
- }
- break;
- case UNUSED:
- fprintf(stdout,"%c",'U');
- break;
- default:
- fprintf(stdout,"%c",'?');
- }
- }
- else
- fprintf(stdout,"%c",cmaze[i][j]);
- fprintf(stdout,"\n");
- }
- return;
- }
-