Hey hey hey,
First off, full disclosure. This is a side project which broke off from an assignment for Uni, part of the code in question is going to be used in an assignment and therefore I won't be able to post much of it in case it shows up on google and I'm though to have plagiarised it. And of course this means I'll be unable to use any code you directly write, therefore textual help > code.
On to the meat and veg. Most of the program uses the becker robots package (the assignment is to program a robot that can escape any maze it's put in). The side project I came up with is a method that scans in a .lozmap file which contains all the information required to construct the maze and place the robot (see pic).
It loads up the map fine, however once the map is loaded I get a wonderful NullPointer in main line 14, which is:
and in A1, line 190 which is:Code:A1.makeAMove(myRobot);
A1 being the class containing the method which escapes the maze, and makeAMove being the method in said class.Code:if(myRobot.frontIsClear())
Obviously then the problem is with myRobot. I'm certain I've declared it correctly:
And it doesn't seem to matter where I put it, the end result is the same. I've tried in A1, the main and in my map reader class (LozTools) to no avail. I've also made sure that the Robot is declared before any use of myRobot.Code:public static Robot myRobot;
I'm running out of ideas, +rep to anyone who can come up with something to help![]()










Reply With Quote


