I finally have the 2d array method up and running more or less. Most of my problem revolved around silly mistakes and odd bugs that normally comes with programming. One of the problems with the assignment that I found agitating was the fact that I had to anticipate that there would be an iteration through this program in which destinations (the array of grid coordinates) might be null. Another problem I found was when my code caused a crash, the window for the game lingered and couldn't be killed unless I used the Task Manager. Another problem I was having with the program was that I couldn't properly debug with break points at the like. I had to resort to print statements to tell me what was happning.
I have it such that the correct costs are printing out however the direction the red pointers is still wrong. It stalls when it tries to put up the direction to the destination. I'll have to hammer out these bugs. After a little bit of tinkering around, I tweaked my DNode (which held information for pi and d) such that pi was a GridCord rather than another DNode. After I made those modifications, the program worked as expected. There were no performance issues to note (other than the tower didn't shoot anything, that would be fun if it did, maybe that's a later assignment).
With the Grid method done, I may return to my linked list method (which is awful) or move on to working with a hash set. I might do the hash set one since that may be more promising or interesting at least. The linked list verison would be more of a test in patience for debugging than learning about Dijkstra's or Java.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment