Maze Solving Bot (Dijkstra's Algorithm)
BenjaminGrass (13)

Create by a maze and this bot will find the shortest solution!

https://repl.it/@BenjaminGrass/Maze-Solving-Bot-Dijkstras-Algorithm

Just a few notes:
1. To create the maze enter 1's (the path) and 0's (the walls of the maze).
2. The maze must have a uniform row size.
3. There can only be one start (in the top row) and one finish (in the bottom row).
4. The maze can have any number of rows & columns!
5. The shortest path is represented by 2's after the algorithm has run.
Here's an example maze (albeit a simple one):
010
010
010

Comment any bugs you encounter please!

You are viewing a single comment. View All
abishek12 (0)

Input Row ('done' to finish): 11111111
Input Row ('done' to finish): 00000001
Input Row ('done' to finish): 11111111
Input Row ('done' to finish): 10000000
Input Row ('done' to finish): 11111111
Input Row ('done' to finish): 00000001
Input Row ('done' to finish): 11111111
Input Row ('done' to finish): 10000000
Input Row ('done' to finish): done

11111111
00000001
11111111
10000000
11111111
00000001
11111111
10000000

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at ArrToPoints.convert(ArrToPoints.java:119)
at Main.main(Main.java:87)

BenjaminGrass (13)

@abishek12: There are a couple things that the program needs to run correctly:

  1. The maze must have a uniform row size.

  2. There can only be one start (in the top row) and one finish (in the bottom row).

  3. The path cannot run off the side of the maze

So yours should be:

0100000000

011111110

0000000010

0111111110

0100000000

0111111110

0000000010

0111111110

0100000000