Maze algorithm implementation, educational purpose