Mazes - sierra.nmsu.edusierra.nmsu.edu/morandi/oldwebpages/math210Spring2012/Mazes.pdf · Mazes are...

Post on 21-Aug-2018

222 views 0 download

Transcript of Mazes - sierra.nmsu.edusierra.nmsu.edu/morandi/oldwebpages/math210Spring2012/Mazes.pdf · Mazes are...

Mazes

March 2012

Mazes March 2012 1/12

Mazes are often difficult to solve because it is hard to distinguishdead ends. Identifying, and then ignoring, dead ends will result in apath through the maze. Mazes appear to be difficult in part becausethey cause one to make lots of turns, even when you don’t actuallyhave to choose one direction or another.

By representing a maze as a graph, we have a method to be able toignore the turns which only complicate the look of a maze.

Mazes March 2012 2/12

Mazes are often difficult to solve because it is hard to distinguishdead ends. Identifying, and then ignoring, dead ends will result in apath through the maze. Mazes appear to be difficult in part becausethey cause one to make lots of turns, even when you don’t actuallyhave to choose one direction or another.

By representing a maze as a graph, we have a method to be able toignore the turns which only complicate the look of a maze.

Mazes March 2012 2/12

To represent a maze as a graph, we need to focus on what is theimportant information of a maze. The turns which are forced upon uswithout requiring us to make a decision are not important. What weneed to consider are the junctions where we have a choice of a turn.

We represent a maze as a graph by letting the vertices be thejunctions; those spots where we have a choice of a direction to turn.We also include the start and finish of the maze.

Two vertices are connected with an edge if you can get from one toanother without crossing any other junction. In other words, if you gofrom one junction to another without having the choice of making aturn, then those two junctions are connected with an edge.

Mazes March 2012 3/12

To represent a maze as a graph, we need to focus on what is theimportant information of a maze. The turns which are forced upon uswithout requiring us to make a decision are not important. What weneed to consider are the junctions where we have a choice of a turn.

We represent a maze as a graph by letting the vertices be thejunctions; those spots where we have a choice of a direction to turn.We also include the start and finish of the maze.

Two vertices are connected with an edge if you can get from one toanother without crossing any other junction. In other words, if you gofrom one junction to another without having the choice of making aturn, then those two junctions are connected with an edge.

Mazes March 2012 3/12

To represent a maze as a graph, we need to focus on what is theimportant information of a maze. The turns which are forced upon uswithout requiring us to make a decision are not important. What weneed to consider are the junctions where we have a choice of a turn.

We represent a maze as a graph by letting the vertices be thejunctions; those spots where we have a choice of a direction to turn.We also include the start and finish of the maze.

Two vertices are connected with an edge if you can get from one toanother without crossing any other junction. In other words, if you gofrom one junction to another without having the choice of making aturn, then those two junctions are connected with an edge.

Mazes March 2012 3/12

How to Draw the Graph of a Maze

Mazes March 2012 4/12

First draw all possible paths. Those are shown in blue in the figurebelow to the right.

Mazes March 2012 5/12

First draw all possible paths. Those are shown in blue in the figurebelow to the right.

Mazes March 2012 5/12

Next, erase the boundaries, leaving only the paths. This is notnecessary, but can help to do the next step.

Mazes March 2012 6/12

Next, erase the boundaries, leaving only the paths. This is notnecessary, but can help to do the next step.

Mazes March 2012 6/12

Mark all the junctions, including the start and finish. Recall that thejunctions are the vertices of the graph.

Mazes March 2012 7/12

Mark all the junctions, including the start and finish. Recall that thejunctions are the vertices of the graph.

Mazes March 2012 7/12

Draw the edges by connecting two vertices only if you can get fromone to the other without crossing another junction. Drawing theedges as straight lines makes the situation as simple as possible.

Mazes March 2012 8/12

Draw the edges by connecting two vertices only if you can get fromone to the other without crossing another junction. Drawing theedges as straight lines makes the situation as simple as possible.

Mazes March 2012 8/12

Dead ends can be represented as short paths that don’t end at avertex. Alternatively, they can be ignored, especially if it is clear whatare dead ends.

Mazes March 2012 9/12

Dead ends can be represented as short paths that don’t end at avertex. Alternatively, they can be ignored, especially if it is clear whatare dead ends.

Mazes March 2012 9/12

Graph and Solved Maze

Mazes March 2012 10/12

Once you have the graph, find a path from the start to the finish.Comparing the graph and the original drawing of paths will then giveyou a route through the maze.

Mazes March 2012 11/12

The mazes shown in class today were created at the web sitehereandabove.com/maze

Mazes March 2012 12/12