使用栈和队列实现迷宫路径查找算法(二)
.empty()) { pointpos = pointqueue.front(); pointqueue.pop(); if(Count<1 && !countqueue.empty()) { Count = countqueue.front(); countqueue.pop(); } if(0 == Count) continue; --Count; // count记录每个坐标点有路径的方向个数 int i,j; i = pointpos.x; j = pointpos.y; //cout<
0 && i
0 && j
0 && i
max) { ni = i-1; nj = j; max = map[i-1][j]; } if(3 == map[i-1][j]) break; if(map[i+1][j] > max) { ni = i+1; nj = j; max = map[i+1][j]; } if(3 == map[i+1][j]) break; } // 左右判断 if(j>0 && j
max) { ni = i; nj = j-1; max = map[i][j-1]; } if(3 == map[i][j-1]) break; if(map[i][j+1] > max) { ni = i; nj = j+1; max = map[i][j+1]; } if(3 == map[i][j+1]) break; } //cout<
3) cout<<0<<' '; else cout<