Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in AreaMap#registerEdges() #4

Open
GoogleCodeExporter opened this issue Aug 26, 2015 · 1 comment
Open

Bug in AreaMap#registerEdges() #4

GoogleCodeExporter opened this issue Aug 26, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create a new AreaMap with x=30, y=30
2. Create obstacles[][] array with the same dimensions
3. look for shortest path between 0,1 and 29,29

What is the expected output? What do you see instead?
It should return path object
It returns null only.

Please provide any additional information below.
This is due to a bug in AreaMap#registerEdges()

Please fix it !!




Original issue reported on code.google.com by moha...@gmail.com on 13 Apr 2014 at 8:35

@GoogleCodeExporter
Copy link
Author

Change to this:

    private void registerEdges() {
        for (int x = 0; x < mapWith; x++) {
            for (int y = 0; y < mapHeight; y++) {
                Node node = map.get(x).get(y);
                if (!(y == 0))
                    node.setNorth(map.get(x).get(y - 1));
                if (!(y == 0) && !(x == mapWith - 1))
                    node.setNorthEast(map.get(x + 1).get(y - 1));
                if (!(x == mapWith - 1))
                    node.setEast(map.get(x + 1).get(y));
                if (!(x == mapWith - 1) && !(y == mapHeight - 1))
                    node.setSouthEast(map.get(x + 1).get(y + 1));
                if (!(y == mapHeight - 1))
                    node.setSouth(map.get(x).get(y + 1));
                if (!(x == 0) && !(y == mapHeight - 1))
                    node.setSouthWest(map.get(x - 1).get(y + 1));
                if (!(x == 0))
                    node.setWest(map.get(x - 1).get(y));
                if (!(x == 0) && !(y == 0))
                    node.setNorthWest(map.get(x - 1).get(y - 1));
            }
        }
    }

Original comment by rhma...@gmail.com on 16 Sep 2014 at 12:15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant