一个小代码~

bfs写了个棋盘走迷宫小游戏,大佬优化一下无解情况,谢谢
#include
#include
using namespace std;
struct node{
int x,y;
int step;
};
int dir[4][2]={0,1,0,-1,-1,0,1,0};
int m,n,dis,g[105][105];
bool vis[105][105];
void bfs(int xs,int ys,int xe,int ye){
queue q;
node s,temp;
s.x=xs,s.y=ys,s.step=0;q.push(s);vis[xs][ys]=1;
while(!q.empty()){
node u=q.front();
q.pop();
for(int i=0;i<4;i++){ int dx=u.x+dir[i][0],dy

一个小代码~最先出现在Python成神之路

版权声明:
作者:主机优惠
链接:https://www.techfm.club/p/10115.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>