Desklib's Maze Solver AI is an advanced algorithm designed to solve any maze with ease. The AI can move the player to all the keys and then to the exit to solve the maze. The Maze Solver AI uses the methods provided in Maze.h to move the player and look for objects in the maze. The AI can handle mazes up to 500x500 in size and can solve even the most complex mazes. Try Desklib's Maze Solver AI now and get the fastest solution to any maze!
| 2 pages
| 917 words
| 172 views
Trusted by 2+ million users, 1000+ happy students everyday
Background: You are writing an AI for solving a maze. The maze has 3 important objects, the player, the exit, and keys. The player is the only object that can move. To solve the maze, the player must move onto all of the keys, and then move onto the exit. You have been given 4 files: Maze.c - Which contains definitions of functions I've written. Maze.h - Which contains headers for functions I've written. Main.c - Which contains the main method I've written. MazeSolver.h - Which contains methods I've started for you. You will only be submitting MazeSolver.h! Don't make edits to the other three, as I will be using my original copies, not your versions!Compiling & Running: To compile your project with my files, you will need them all in the same directory. You will also need to alert the linker to them somehow. I do not know how to do this inside of Netbeans, Codeblocks, etc, but from the terminalyou should just type: gcc Main.c Maze.c Maze.h MazeSolver.h To run the program, you will need to supply a single argument, which is the name of the maze file. I don't know how to do this from any IDE but I assure you it is possible. To run it from the terminal, just type./a.out (a.exe) <file_name>Explanation of maze files: 0 - Wall 1 - Empty Space 2 - Player 3 - Key 4 - Exit The maximum size for a maze is 500x500.Explanation of Maze.h: Here are the methods from Maze.h that you might want to use: int getNumSteps() - returns the number of steps which you have made so far. Might be useful for debugging purposes. void getCurrentPosition(int * arr) - this puts the player's row into arr[0], and the player's column into arr[1]. void readMaze() - using this is considered cheating. void printMaze() - prints the current maze. Might be useful for debugging. int isComplete() - returns 1 if the maze is complete, and 0 otherwise. Useful for loop conditions int move(int newRow, int newCol) - if possible, it moves the player to theposition specified. Returns 1 if move succeeds, 0 otherwise. If not possible, it prints a handy error message explaining what happened. You are definitely allowed to comment out the print statements if you get tired of seeing the error messages.
Found this document preview useful?
You are reading a preview Upload your documents to download or Become a Desklib member to get accesss