public static String getMazeStringSolution ( Maze2D maze , Collection < Point > explored , Collection < Point > path ) { List < Map < Point , Character > > replacements = new ArrayList < Map < Point , Character > > ( ) ; Map < Point , Character > replacement = new HashMap < Point , Character > ( ) ; for ( Point p : explored ) { replacement . put ( p , ' ' ) ; } replacements . add ( replacement ) ; replacement = new HashMap < Point , Character > ( ) ; for ( Point p : path ) { replacement . put ( p , ' ' ) ; } replacements . add ( replacement ) ; return maze . getReplacedMazeString ( replacements ) ; }
Returns the maze passed as parameter but replacing some characters to print the path found in the current iteration .