{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Maze3D - Maze3D.java Author Lewis/Loftus Solution to...

This preview shows pages 1–2. Sign up to view the full content.

//******************************************************************** // Maze3D.java Author: Lewis/Loftus // // Solution to Programming Project 11.4 // // Represents a 3D maze of characters. The goal is to get from the // top left near corner to the bottom right far corner, following a path of 1s. // Prints the path of the final solution as it is discoverd. //******************************************************************** public class Maze3D { private final int TRIED = 3; private final int PATH = 7; private int[][][] maze; private int[][][] grid; public Maze3D(int[][][] newMaze) { maze = newMaze; } //----------------------------------------------------------------- // Creates a working copy of the maze to compute the final solution. // The original maze is not modified. Calls traverse to recursively // traverse the maze. //----------------------------------------------------------------- public boolean traverseMaze (int row, int column, int page) { // make copy of maze grid = new int[maze.length][maze[0].length][maze[0][0].length]; for (int i = 0; i < maze.length; i++) for (int j = 0; j < maze[i].length; j++) for (int k = 0; k < maze[i][j].length; k++) grid[i][j][k] = maze[i][j][k]; return traverse(row, column, page); } //----------------------------------------------------------------- // Attempts to recursively traverse the maze. Inserts special // characters indicating locations that have been tried and that // eventually become part of the solution. //-----------------------------------------------------------------

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}