JS==>实现老鼠走迷宫问题
/** maze:迷宫 pos:位置 path:路径 transverse:老鼠走过的地方**/function rat_in_maze(maze, pos = [0, 0], path = [ [...pos]], transverse = []) { const [x, y] = pos; if (maze[x][y] === 2) { //终点 return path; } // 记录走过当
原创
2020-09-22 17:09:29 ·
267 阅读 ·
0 评论