Pathfinder

Algorithms implemented

Pahtfinding

  • Depth First Search [depth_first_search]
  • Breadth First Search [breadth_first_search]
  • Best First Search [best_first_search]
  • A* [a_star_search]
  • Hill Climbing [hill_climbing]

Maze generation

  • Kruskal-based

Usage

# Compile project
make all 

# This will produce an executable called pathfinder
# Usage: pathfinder <filename> <algorithm> 
$ ./pathfinder --help
Available parameters:

  -h    --help

   This parameter is optional. The default value is ''.

  -a    --algorithm     (required)
   Pathfinding algorithm.

  -i    --input
   Input file.
   This parameter is optional. The default value is ''.

  -o    --output
   Output file.
   This parameter is optional. The default value is ''.

  -g    --generate
   Generate maze with {rows}, {cols}, (optional){seed}.
   This parameter is optional. The default value is '[ ]'.

  -d    --dist
   Distance metric. Use manhattan or euclidean.
   This parameter is optional. The default value is 'manhattan'.

  -v    --verbose
   Prints output to stdout.
   This parameter is optional. The default value is '0'.

  -e    --export
   Exports input maze to file.
   This parameter is optional. The default value is ''.

# Example with input file and print on stdout
$ ./pathfinder -a a_star_search -d manhattan -i res/maze_input.txt -o res/maze_solved.txt -v

# Example with the maze generator and print on stdout
$ ./pathfinder -a depth_first_search -g 10 60  -v

-#----------------------------------------------------------
-**---**---**-****--****-***-*--*-******--**--***-**-****-*-
--***-*-***-*--*-*--*--**--*-******--*--***-***--**-**--***-
-**-***-*-***-**-*-***--**-*---*---***-**-***-****-**-***-*-
-*---*--*-----*--***--**---**-****-*-***-*--**-*-***-**-*-*-
--********-******-----*-**-*-**--**----*****-----*--*--**-*-
-*-*--*---**----*-******-*-***-**-**-**----*****-*-***---**-
-***-******-*-*-*-*--*-*****-*--**-***-*-***-*-**-**-****---
--*-**----*****-***--**------***-***-***-*---**-***---*-***-
----------------------------------------------------------$-

-o----------------------------------------------------------
-oo---**---**-****--****-***-*--*-oooo**--**--***-**-****-*-
--ooo-*-***-*--*-*--*--**--*-**oooo--o--***-***--**-**--***-
-**-oo*-*-***-**-*-***--**-*---o---**o-**-***-****-**-***-*-
-*---o--*-----*--***--**---**-oo**-*-ooo-*--**-*-***-**-*-*-
--***oo***-oooooo-----*-**-*-oo--**----ooooo-----*--*--**-*-
-*-*--o---oo----o-oooooo-*-ooo-**-**-**----ooooo-*-ooo---**-
-***-*ooooo-*-*-o-o--*-ooooo-*--**-***-*-***-*-oo-oo-oooo---
--*-**----*****-ooo--**------***-***-***-*---**-ooo---*-ooo-
----------------------------------------------------------o-

Note

  • One has two options to specify an input maze: through a file and by specifying valid arguments to the Maze generator using the -g flag.
  • If one wants the input and output maze printed to stdout, use the -v flag.
  • If one wants to save the maze generated by the Maze Generator, use the -e flag.