our directions have been checked
and s is not empty. */
{
MarkPrint(e.seat);
gotoxy((e.seat.y 1)*2,e.seat.x 2);
putch(''''''''''''''''''''''''''''''''@'''''''''''''''''''''''''''''''');
delay(8000); /* Pospone time. */
gotoxy((e.seat.y 1)*2,e.seat.x 2);
putch('''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''');
e=Pop(s,e); /* Remove e from s. */
curstep--;
}
if(e.di<4) /* The current position hasnot been checked. */
{
e.di ;
Push(s,e); /* Insert e into s. */
curpos=NextPos(e.seat,e.di); /* Try next position. */
}
}
}
}
while(!StackEmpty(s));
DesoyStack(s);
return FALSE;
} /* MazePath */
void main()
{
PosType start,end;
CreatMaze();
start.x=StartPlace.y;
start.y=StartPlace.x;
end.x=EndPlace.y;
end.y=EndPlace.x;
if(MazePath(start,end))
{
gotoxy(2,22);
printf("Path found\n");
}
else
{
gotoxy(2,22);
printf("Path not found\n");
}
getch();
clrscr();
}
上一页 [1] [2] [3] [4] [5]