Ask a question from expert

Ask now

extern int getTotalKeys();.

2 Pages405 Words183 Views
   

Added on  2019-09-20

extern int getTotalKeys();.

   Added on 2019-09-20

BookmarkShareRelated Documents
extern int getTotalKeys();extern int getCurrentKeys();extern int getNumSteps(); // returns the number of steps which you have made so far. Might be useful for debugging purposes.extern void getCurrentPosition(int * arr); // this puts the player's row into arr[0], and the player's column into arr[1].extern void readMaze(); // points will be taken off if you use this.extern void printMaze(); // prints the current maze. Might be useful for debugging.extern int isComplete(); //returns 1 if the maze is complete, and 0 otherwise.Useful for loop conditionsextern int move(int newRow, int newCol); // if possible, it moves the player to the position specified. Returns 1 if successful move, 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.extern int look(int newRow, int newCol); // if possible, it tells you what's in the square you are looking at. It also returns the integer value of what isin the square (see maze file explanation), or -1 if the look failed. 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.void solveMaze();int moveRight();int moveLeft();void solveMaze(){ printMaze(); while(!isComplete()){ while(moveLeft()){ printMaze(); } while(moveRight()){ printMaze(); } }}int moveRight(){ int currentPos[2]; getCurrentPosition(currentPos); return move(currentPos[0], currentPos[1]+1);}int moveLeft(){ int currentPos[2]; getCurrentPosition(currentPos); return move(currentPos[0], currentPos[1]-1);}
extern int getTotalKeys();._1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
#include <stdio.h>.
|1
|263
|147

Maze Solver AI for Desklib
|2
|917
|172

Static int maze.h
|4
|1383
|50