Categories

Innerworkings

This site is powered by WP and hosted by 1&1. Made with valid XHTML. Version the Second.

Sonic Light Speed
Vector Green
OTP Manager
Maze Solver
23.02.08

Maze Solver

Maze Solver is a program I wrote in Java. As its name implies, it can solve mazes. I have already written an extensive series of entries about the innerworkings of the program, so I won’t reiterate everything here. The entries are:

  1. Maze-Solving Program: The Algorithm
  2. Maze-Solving Program: The Code
  3. Maze-Solving Program: Some Bugs

The basics of the program’s functioning was explained in the first entry:

  1. If the square to the left of the current square hasn’t been traveled, move to that square.
  2. Otherwise, if the square ahead of the current square hasn’t been traveled, move to that square
  3. Otherwise, if the square to the right of the current square hasn’t been traveled, move to that square
  4. Otherwise, if the square to the left of the current square has been traveled, move to that square.
  5. Otherwise, if the square to the right of the current square has been traveled, move to that square.
  6. Otherwise, if the square ahead of the current square has been traveled, move to that square.
  7. Finally, if none of the previous conditions were true, go back one step to the previous square.

Maze Methods

  • Solve()
  • PrintSolution()
  • PrintMaze()
  • Reset()
  • ChangeSquare(int row, int col, int val)
  • ChangeStart(int row, int col)
  • ChangeFinish(int row, int col)

Screenshot

Maze Solver Screenshot

Download

The maze class as well as the GUI.