代码大全

(singke) #1
C

BOOLEAN function FindPathThroughMaze
(
MAZE_T MAZE ,
POINT Position
)
{
/ if the position has already been tried,don’t try it again /
if (alreadyTried(Maze,Position))
return(FALSE);


/ if this position is the exit,declare success /
if (ThisIsTheExit(maze,Position))
return(TRUE);


/ remember that this position has been tried /
RememberPosition(Maze,Position);


/ check the paths to the left,up,down,and to the right;
if any path is successful,stop looking
/
if ( MoveLeft( Maze , Position , &NewPosition ) )
if ( FindPathThroughMaze ( Maze , NewPosition ) )
return( TRUE );


if ( MoveUp( Maze , Position , &NewPosition ) )

Free download pdf