Results 1 to 2 of 2
- 11-18-2012, 07:08 PM #1Member
- Join Date
- Nov 2012
- Rep Power
[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.
- 11-20-2012, 10:47 PM #2
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.
- By newbie123 in forum AWT / SwingReplies: 0Last Post: 05-30-2012, 11:14 PM
- By dacoolest in forum New To JavaReplies: 1Last Post: 01-11-2012, 09:42 PM
- By Mr.Beans in forum Forum LobbyReplies: 3Last Post: 05-05-2009, 10:40 PM
- By TalhaS in forum New To JavaReplies: 0Last Post: 03-19-2008, 09:28 PM