Writing mazeSolver