[Assignment] BFT using Directed Graphs, but having an issue with the traversal.
Hey every one, First time here on the forums and hopefully not my last.
I've been working on my assignment for a little over 3 weeks now, however I started it with the wrong type of algorithm, but that's not an issue now and I have the correct algorithm, but I've got an issue where I have a bot that is attempting to traverse a directed graph how ever, on some occasions the BFT (Breadth First Traversal) algorithm being used is not generating the correct array result, causing the bot to crash and die a horrid and unfortunate death.
I've posted the bot code, maze and the debugging information here on pastebin, new maze - Pastebin.com
from what I can figure is that although the BFT algorithm is finding the exits appropriately, I don't think it is being put into the array list properly, and so when it comes to time where the bot is supposed to traverse the graph using the chooseNextNode() method, it tries to move to a node that isn't a neighbour of the node that is in the provided array list. causing the bot to crash, how ever i cant figure out for the life of me how to fix this, or why it is happening.
Any help on this would be greatly appreciated.
Re: [Assignment] BFT using Directed Graphs, but having an issue with the traversal.
So, you need to approach it like this:
Start with a really simple graph and run your algorithm. See if you can reproduce the problem with the simplest tree you can find. Once you have an input that reliably reproduces the bug, you need to step through your code with the debugger while simultaneously doing it on a sheet of paper. This is the only way to find where your algorithm is in error - you might have an unhandled edge case or an off by 1 error somewhere.