| | |
| | | } |
| | | |
| | | public boolean is_valid(int x, int y) { |
| | | // 如果结点的位置小于0,则不合法 |
| | | if (map[x][y] < 0) return false; |
| | | for (NavigateNode node : Exist) { |
| | | //如果结点出现过,不合法 |
| | | if (node.getX() == x && node.getY() == y) { |
| | | return false; |
| | | try { |
| | | // 如果结点的位置小于0,则不合法 |
| | | if (map[x][y] < 0) return false; |
| | | for (NavigateNode node : Exist) { |
| | | //如果结点出现过,不合法 |
| | | if (node.getX() == x && node.getY() == y) { |
| | | return false; |
| | | } |
| | | if (is_exist(new NavigateNode(x, y))) { |
| | | return false; |
| | | } |
| | | } |
| | | if (is_exist(new NavigateNode(x, y))) { |
| | | return false; |
| | | } |
| | | //以上情况都没有则合法 |
| | | return true; |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | //以上情况都没有则合法 |
| | | return true; |
| | | } |
| | | |
| | | public boolean is_exist(NavigateNode node) |