public final class

MazeSearch

extends Object
java.lang.Object
   ↳ es.usc.citius.hipster.util.examples.maze.MazeSearch

Class Overview

This class executes the search iterators over maps of type Maze2D. And prints the results in the console.

Summary

Nested Classes
class MazeSearch.Result Inner class to define the results of the search process over Maze2D
Public Methods
static void clearOutput(int newlines)
Clears the output of the console between results printed by printSearch(java.util.Iterator, Maze2D).
static String getMazeStringSolution(Maze2D maze, Collection<Point> explored, Collection<Point> path)
Returns the maze passed as parameter but replacing some characters to print the path found in the current iteration.
static void printSearch(Iterator<? extends Node<?, Point, ?>> it, Maze2D maze)
Prints the maze and the result of the current iteration until the solution is found.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static void clearOutput (int newlines)

Clears the output of the console between results printed by printSearch(java.util.Iterator, Maze2D).

Parameters
newlines number of new lines

public static String getMazeStringSolution (Maze2D maze, Collection<Point> explored, Collection<Point> path)

Returns the maze passed as parameter but replacing some characters to print the path found in the current iteration.

Parameters
maze used to search
explored collection of the points of the maze explored by the iterator
path current path found by the iterator
Returns
  • maze with the characters of the explored points and the current path replaced, to print the results in the console

public static void printSearch (Iterator<? extends Node<?, Point, ?>> it, Maze2D maze)

Prints the maze and the result of the current iteration until the solution is found.

Parameters
it search iterator
maze maze to perform the search
Throws
InterruptedException sleep exception between iterations