Hi I am working on this new Java swing pathfinding project using A* and Dijkstra algorithms, I have made my program run fine but I was wanting to add a third value to my Node, before it would have been Node[x][y] but i am trying to make it take a third value which would be the theta or in this case a robot angle, Node[x][y][theta]. I am getting an error when I do this and to be honest I am not sure exactly how to go about even adding this. The program currently prompts you for the robot angle or theta once you plot the Start or End node.
here is my github repo for the project, it is not updated yet so everything should still be functional the project is under FrcVersion. https://github.com/mohammadawwad/Java-Pathfinding/tree/master/Pathfinding/src/FRCVersion
here is where I get my error
map = new Node[cellsWidth][cellsHeight][(int) theta];
for (int x = 0; x < cellsWidth; x++) {
for (int y = 0; y < cellsHeight; y++) {
map[x][y][(int) theta] = new Node(2, x, y, theta);
//sets all nodes to blank
}
}
This is the error message
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2
at FRCVersion.FrcApp.cleanMap(FrcApp.java:115)
at FRCVersion.FrcApp.<init>(FrcApp.java:97)
at FRCVersion.Main.main(Main.java:5)
I would like to thank everyone in advance for any help or advice. I am sorry if this seems like i am doing something supper stupid its the first time I use nodes and am still learning