Liam Mass

Greenhorn
+ Follow
since Sep 30, 2015
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Liam Mass

Thanks for being so friendly on this community! I think I'm almost done my maze. I have a file called MazeRunner with preprogrammed mazes another file called MazeUtils that allows the user to choose and play a maze, by moving an "o" through "x's" that represent walls. I'm experiencing one last issue, though. Upon entering a direction for the "o" to move, I get an error that reads: 'Exception in thread "main" java.lang.NullPointerException .' The error points to the part of code for each direction that says:

if(map[location[a]-1][location[b]]==1)
System.out.println("There's a wall here!");

For example, if I type in "u" to go up, the error will point to line 90 in MazeUtils.
Can anybody help me figure out what is wrong with the math here? I'm not sure what's causing the issue. Thank you very much for the help!
Here's the MazeRunner file:




And here's the MazeUtils file:

5 years ago
Thanks for your help! By the way, the x and y on lines 72 and 73 are integers that are supposed to be the coordinates of where the user starts on the maze with the "o" character. They are different based on the maze chosen
5 years ago
Hello, I have been tasked to create a program that allows a user to choose any one of three premade mazes, and then move an "o" on the screen to solve it. X's represent walls. I think I have a most of, if not all of the advanced looping parts done that allows the user to enter multiple commands instead of just one, and also interprets a single input with many commands such as "urrl" (Where "u" is up, "r" is right, etc.)

It is okay for the maze to reprint each time they move the "o," it does not have to be a GUI project.

However, when I added the necessary loops to achieve this goal, now the maze won't even print out the first time. I'm using eclipse and it says the program was terminated before the maze was printed out even once. What did I do wrong with printing the maze?




5 years ago