theHaws.org
Home of the strange.
Techie Fun Friends
Jo Ann's
Resume
Mazes Crafts Contact

 
We do not take paid advertising on our site. However, we would appreciate it if visitors took a moment to visit sites for projects of our own to see if there's anything there that might interest them.

Bash Down the Door and Slice Open the Badguy! - an anthology for which Kevin wrote the humorous fantasy story, "The Order of the Crimson Tunic":


MazeApplet v3.0 & MazeIcon v3.0

I have written two Java applets that draw mazes, MazeApplet and MazeIcon. The first draws larger mazes with a number of shapes while the later is optimized to make smaller ones for use as an icon or decorative border on a web page.

I invite you to use them and tell me what you think via the mail link on the left side of the page. If you don't know how to put an applet on your page, check out this great tutorial.

MazeIcon
The MazeIcon applet draws a maze in a small area, suitable for use on a webpage as an icon or horizontal or vertical border.  Several parameters allow the user to choose the shape of the tiles in the maze, display the solution, change the various colors of the maze, link it to a URL, or have it periodically draw a new maze. 

Here are some of the components to MazeIcon you can download and use as you wish:

  • JavaBoutique has a .ZIP file of all sources, classes, the .jar, and sample HTML to show how to use MazeIcon (similar to the table below).
  • Here is my local copy of the .ZIP file. Please use this if you have problems with the link above.
  • Here's the source to MazeTile, the base class to set up mazes of a given shape.
  • Here's the source to MazeIcon, the applet which actually draws the maze.
  • Finally (not really a download), click here to see MazeIcon's page at the Java Applet Rating Service (www.jars.com).

Here is the source to MazeApplet. Here is a local copy of the .ZIP file for downloading.

The table below shows various ways MazeIcon can be used.
 

This is the MazeIcon set up with the default color settings, used as a link icon.  The solution is not shown, but can be toggled on with a right-click.  The maze only redraws on a refresh of the whole screen. Here is the HTML to make it work: 

<applet archive="MazeIcon.jar"
  code=MazeIcon.class 
  width=50 height=50>
<param name=href value=
  "http://www.theHaws.org/MazeApplet.shtml">
<param name=alt value= "Click for
  Kevin's Maze Page">
</applet> 

Here is a  flashier version, turning on the solution and using a refresh to draw the eye. Here's the HTML: 
<applet archive="./compiled_java/MazeIcon.jar"
  code=MazeIcon.class
  width=50 height=50>
<param name=bgColor value="33CCFF">
<param name=fgColor value="000000">
<param name=solution value="on">
<param name=solColor value="FFFF00">
<param name=refresh value="2">
<param name=href value= 
  "http://theHaws.org
    /MazeApplet.shtml">
<param name=alt value="Click for
  Kevin's Maze Page">
</applet>
Here is an icon with the solution locked on, using the diamond tile shape. 

<applet archive="./compiled_java/MazeIcon.jar"
  code=MazeIcon.class 
  width=50 height=50>
<param name=bgColor value="FFCCCC">
<param name=fgColor value="000000">
<param name=tileShape 
  value="diamond">
<param name=solution 
  value="on">
<param name=href value=
  "http://www.theHaws.org
    /MazeApplet.shtml">
<param name=alt value= "Click for
  Kevin's Maze Page">
</applet>

Here is an example of hex shaped tiles. The HTML is 

<applet archive="./compiled_java/MazeIcon.jar"
  code=MazeIcon.class 
  width=70 height=50>
<param name=bgColor value="009900">
<param name=fgColor value="FFFF00">
<param name=tileShape value="hex">
<param name=href value= 
  "http://www.theHaws.org 
    /MazeApplet.shtml">
<param name=alt value="Click for 
  Kevin's Maze Page">
</applet> 

Here's MazeIcon used as a simple horizontal border with square tiles. Solution has been turned on so it can be toggled off with a right-click.
Use this HTML: 

<applet archive="./compiled_java/MazeIcon.jar" code=MazeIcon.class width=500 height=30>
  <param name=fgColor value="000000">
  <param name=solution value="toggleOn">
  <param name=alt value="A Border">
</applet>

Here's hex shaped tiles with an eye grabbing refresh.

<applet archive="./compiled_java/MazeIcon.jar" code=MazeIcon.class width=500 height=50>
  <param name=tileShape value="hex">
  <param name=bgColor value="FF6600">
  <param name=fgColor value="000000">
  <param name=solColor value="FFFFFF">
  <param name=solution value="on">
  <param name=alt value="Another Border...">
  <param name=refresh value="3">
</applet>

Here's an elegant vertical border using the diamond tile shape.  Display of the solution has been shut off with the toggleOff tag. It uses this HTML: 

<applet archive="./compiled_java/MazeIcon.jar"
  code=MazeIcon.class 
  width=30 height=200>
<param name=bgColor value="FFCC00">
<param name=fgColor value="000000">
<param name=tileShape 
  value="diamond">
<param name=solution 
  value="off">
<param name=alt 
  value="Elegant Border">
</applet>

By setting the background and foreground to the same color as the page beneath, only the solution stands out.  With a fast refresh on hex tiles, it makes a dancing squiggle. 

<applet archive="./compiled_java/MazeIcon.jar"
  code=MazeIcon.class 
  width=50 height=200>
<param name=bgColor value="999999">
<param name=fgColor value="999999">
<param name=solColor value="FFFFFF">
<param name=solution value="on">
<param name=refresh value="1">
<param name=tileShape value="hex">
<param name=alt value="Squiggle">
</applet> 

MazeApplet
MazeApplet is a java applet that builds mazes based on various shaped tiles. The user can select the tile from the pulldown menu.

MazeApplet is written to be compliant with JAVA 1.1 or earlier.  While it restricts me from doing a lot of cool stuff. it still served to teach me the basics of JAVA and also allows anyone using older versions of Netscape Navigator or any version of Internet Explorer to view it without any plug ins.

Here are the basic instructions:

  • Click through the maze to try to solve it (from start to finish). The trail you pass will be marked. You can backtrack just by clicking on a tile you already hit. When finished (clicking on "end"), you will be told your time. On IE, you can drag the mouse if you wish, but on Netscape you have to click on every tile one at a time. (Working on that...)
  • Use the "New Maze" button to draw a maze.
  • Use the "Solve" button to get the solution.
  • Select the shape of the maze from the pulldown menu. NOTE: The "triangle" shapes have a glitch that gives them a jagged border in IE and simply fails to show up in Netscape.

If you're interested in the JAVA source, it uses two classes: MazeTile, the general class to set up mazes, and MazeApplet, which actually draws the maze as requested on the web page. Please EMAIL me any comments or check out my homepage.

MazeApplet

Improvements

Naturally, this is a work in progress.  Here are some refinements I'm planning for MazeApplet and/or MazeIcon:
  • Fix the grayed out backgrounds on IE.
  • Interactive clicking - fix mouse dragging for Netscape. Also fix the flicker that occurs on dragging.
  • On the "triangle" mazes, fix the jagged bottom edge for IE and just make it work for Netscape.
  • Variable frame regions, to allow a maze inside a heart or Christmas tree or whatever.
  • Compile the thing as a stand alone application.
  • Printer support.
  • Add a webpage explaining the algorithm.
  • Variable start and finish labels.  Being able to pass GIFs for icons and and the search cursor (see "animate solution", below) would be neat, too.
  • Support "skip mazes."  A teacher I know indicates that she uses mazes with numbers placed in some of the cells.  The kids (second graders) have to count by fives or tens or whatever, tracing the path to the next number in the sequence.
  • An "animate solution" to show the solution search, using a dedicated thread and a sleep delay so a viewer can see the action..  Perhaps a GIF of a mouse would be a neat cursor for that one.  A flag to draw a new maze once the old one is solved and a flag for search speed as applet parameters would be needed.  .
All contents copyright 2000-2001
Kevin N. Haw and JoAnn K. Haw
Page Last Modified: 07/11/08