(int i, int j, int d)
| 27 | } |
| 28 | |
| 29 | private void dfs(int i, int j, int d) { |
| 30 | robot.clean(); |
| 31 | vis.add(List.of(i, j)); |
| 32 | for (int k = 0; k < 4; ++k) { |
| 33 | int nd = (d + k) % 4; |
| 34 | int x = i + dirs[nd], y = j + dirs[nd + 1]; |
| 35 | if (!vis.contains(List.of(x, y)) && robot.move()) { |
| 36 | dfs(x, y, nd); |
| 37 | robot.turnRight(); |
| 38 | robot.turnRight(); |
| 39 | robot.move(); |
| 40 | robot.turnRight(); |
| 41 | robot.turnRight(); |
| 42 | } |
| 43 | robot.turnRight(); |
| 44 | } |
| 45 | } |
| 46 | } |