hi, i am working on project for school and so far the only problem i cannot figure out are these large blocks of spaces that show up in my output of my text file. The premise is to design the logic behind a maze pathfinding cowboy. If someone could look at the solve method and tell me why this is going on i would greatly appreciate it. all code besides the logic was written by my teacher just so you know.
For what it's worth, I put the "Code" tags around your code, to make it more readable. However there are still two problems:
(1) There's way too much code. Nobody is going to want to dig through all of that to look for your problem.
(2) There isn't enough code. Your code breaks off right in the middle, and none of the code you did post has anything to do with writing to a file. Except the comments.
So if you want help, it would be best if you could cut the size of the program way down. Get rid of all of the code which has nothing to do with writing to the file and just post the relevant part. And next time you write a program: Don't write several hundred lines of code before you start testing it. Test it as you go along. That way finding the bugs isn't nearly as daunting.
For that matter you might want to apply that advice to this program. Start over and test the code as you write it.
Joined: Mar 20, 2012
wow sorry about that lol i have never asked for help with code on a forum before so those tips were very helpful. i have checked all of the code i have written up to this point and everything works fine.
the only problem is the output to file is either not working, or gives me a giant text file with tons of white spaces. I know this is because our teacher wrote the array the maze is handled in to be 255x255 and all that white space is messing with the formatting of the output making the next run of the maze screwy. when i change the size of my print statement to just print for the height by width (like it is below), it doesn't output anything. this is what i have so far for the print (excuse the bad formatting i am just messing with it)
Here's the rule: when you're using a resource (anything which connects with the world outside Java, like a file or a database or a socket connection), always close it when you're finished with it. If you aren't sure whether something you're using counts as a resource, look and see if it has a "close" method. If it does, it's probably a resource.