/******************************************************************************
* [ maze ] ...
*
- * modified: [ 3-7-93 ] Jamie Zawinski <jwz@lucid.com>
+ * modified: [ 8-11-95 ] Ed James <james@mml.mmc.com>
+ * added fill of dead-end box to solve_maze while loop.
+ * modified: [ 3-7-93 ] Jamie Zawinski <jwz@netscape.com>
* added the XRoger logo, cleaned up resources, made
* grid size a parameter.
* modified: [ 3-3-93 ] Jim Randell <jmr@mddjmr.fc.hp.com>
static int maze_size_x, maze_size_y;
static int sqnum, cur_sq_x, cur_sq_y, path_length;
static int start_x, start_y, start_dir, end_x, end_y, end_dir;
-static int maze_restart_flag, random_index;
static int grid_width, grid_height;
static Display *dpy;
static int x = 0, y = 0, restart = 0, stop = 1, state = 1;
+static int
check_events() /* X event handler [ rhess ] */
{
XEvent e;
}
+static void
set_maze_sizes (width, height)
int width, height;
{
}
+static void
initialize_maze() /* draw the surrounding wall and start/end squares */
{
register int i, j, wall;
static void draw_solid_square ();
static void enter_square ();
+static void
create_maze() /* create a maze layout given the intiialized maze */
{
- register int i, newdoor;
+ register int i, newdoor = 0;
do {
move_list[sqnum].x = cur_sq_x;
num_candidates = 0;
- topwall:
/* top wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_TOP )
goto rightwall;
}
+static void
draw_maze_border() /* draw the maze outline */
{
register int i, j;
}
+static void
solve_maze() /* solve it with graphical feedback */
{
int i;
/* do it */
while (1) {
if ( ++path[i].dir >= 4 ) {
+ XFillRectangle(dpy, win, cgc,
+ border_x + bw + grid_width * (int)(path[i].x),
+ border_y + bw + grid_height * (int)(path[i].y),
+ grid_width - (bw+bw), grid_height - (bw+bw));
i--;
draw_solid_square( (int)(path[i].x), (int)(path[i].y),
(int)(path[i].dir), cgc);
/*
- * jmr additions for Jamie Zawinski's <jwz@lucid.com> screensaver stuff,
+ * jmr additions for Jamie Zawinski's <jwz@netscape.com> screensaver stuff,
* note that the code above this has probably been hacked about in some
* arbitrary way.
*/
char *progclass = "Maze";
char *defaults[] = {
+ "Maze.background: black", /* to placate SGI */
+ "Maze.foreground: white", /* to placate SGI */
"*gridSize: 0",
- "*background: black",
"*solveDelay: 5000",
"*preDelay: 2000000",
"*postDelay: 4000000",