回溯迷宫w |递归C ++

时间:2018-10-18 01:38:28

标签: c++ recursion backtracking maze

bool move(int r, int c){
if (r == move - 1 && c == move - 1);
return true;

maze[r][c] = '*';

//下

if (move( r + 1, c) == true){
    move(r + 1, c);
}

//左

if (move( r, c - 1) == true){
    move( r, c - 1);
}

// UP

if (move( r - 1, c) == true){
    move( r - 1, c);
}

//右

if (move(r, c + 1) == true){
    move( r, c + 1);
}

在迷宫中无法移动,无效移动

return false;
}

移动功能正在编译错误

0 个答案:

没有答案