Solving Mazes by Coloring

Many Demonstrations show how to solve a maze with depth-first search or breadth-first search. Another kind of solution is based on coloring the different connected components of the set of walls. Every maze is divided into two components by the solution path, which is just the boundary between the two components. This is easy to see if you color the two components with different colors. Mazes with more than two connected components have more than one solution. This Demonstration lets you generate mazes of size up to 15×15 with up to six connected components and to color them to see the solution.
Large mazes are quite slow to generate in this implementation.

THINGS TO TRY

SNAPSHOTS

  • [Snapshot]
  • [Snapshot]
  • [Snapshot]

DETAILS

This Demonstration was developed for an elementary school math activity at the Waseca Montessori School in Athens, Georgia.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.