سلام
در برنامه ماز یا مسیر مارپیچ شما باید بهینه ترین مسیر برای خارج شدن از مارپیچ را بدست آورید .
مانند تصویر زیر :
این هم تکه کد ابتدایی برای شروع نوشتن برنامه
/* gets the width and height of the maze
checking for the allowed range */
void setCoord(int &nrows,int &ncols) {
if (ncols < = 0 || ncols > 40) {
printf ("Enter maze width: ");
scanf_s ("%d",&ncols);
}
if (nrows < = 0 || nrows > 40) {
printf ("Enter maze height: ");
scanf_s ("%d",&nrows);
}
if (nrows < = 0 || nrows > 40 || ncols < = 0 || ncols > 40) {
printf ("Invalid width or height detected\n\n");
setCoord(nrows,ncols); // recursive call
}
}
پیروز باشید.