关于C++老鼠走迷宫#includebool judge(int **r,int x,int y,int k){bool JUDGE=false;if(k==1)JUDGE=((r[x][y+1]!=5)&&(k!=3));if(k==2)JUDGE=((r[x+1][y]!=5)&&(k!=4));if(k==3)JUDGE=((r[x][y-1]!=5)&&(k!=1));if(k==4)JUDGE=((r[x-1][y]!=5)&&(k!=2));return
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 20:59:32
关于C++老鼠走迷宫#includebool judge(int **r,int x,int y,int k){bool JUDGE=false;if(k==1)JUDGE=((r[x][y+1]!=5)&&(k!=3));if(k==2)JUDGE=((r[x+1][y]!=5)&&(k!=4));if(k==3)JUDGE=((r[x][y-1]!=5)&&(k!=1));if(k==4)JUDGE=((r[x-1][y]!=5)&&(k!=2));return
关于C++老鼠走迷宫
#include
bool judge(int **r,int x,int y,int k)
{
bool JUDGE=false;
if(k==1)
JUDGE=((r[x][y+1]!=5)&&(k!=3));
if(k==2)
JUDGE=((r[x+1][y]!=5)&&(k!=4));
if(k==3)
JUDGE=((r[x][y-1]!=5)&&(k!=1));
if(k==4)
JUDGE=((r[x-1][y]!=5)&&(k!=2));
return JUDGE;
}
void PrintOut(int **g,int size1)
{
for(int a=1;a
关于C++老鼠走迷宫#includebool judge(int **r,int x,int y,int k){bool JUDGE=false;if(k==1)JUDGE=((r[x][y+1]!=5)&&(k!=3));if(k==2)JUDGE=((r[x+1][y]!=5)&&(k!=4));if(k==3)JUDGE=((r[x][y-1]!=5)&&(k!=1));if(k==4)JUDGE=((r[x-1][y]!=5)&&(k!=2));return
#include
bool judge(int **r,int x,int y,int k)//只有当0或100时才返回真,因为如果为1-4,那么说明这个地点曾今来过,程序会兜圈子
{
bool JUDGE=false;
if(k==1)
JUDGE=r[x][y+1]==0||r[x][y+1]==100;
if(k==2)
JUDGE=r[x+1][y]==0||r[x+1][y]==100;
if(k==3)
JUDGE=r[x][y-1]==0||r[x][y-1]==100;
if(k==4)
JUDGE=r[x-1][y]==0||r[x-1][y]==100;
return JUDGE;
}
void PrintOut(int **g,int size1)
{
cout