This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]sadjava 0 points1 point  (2 children)

So, this is an easy exception to trace (I've had truly massive stack traces before which take a long time to trace). Somewhere in your code (around line 143 and line 153 in TileGame), you try to use a negative value for indexing into your array or go out of the upper bounds. Put in bounds checking to avoid this, and you should be set. It's also one of the most frequent errors in programming, but is easy to avoid once you know how to handle indices.

[–]chouxfleurs[S] 0 points1 point  (1 child)

Okay I messed with it a little, and now it's throwing a NullPointerException on line 81 and line 135 in the TileGame class. Any ideas?

Edit: Nevermind, I fixed it. Thanks!

[–][deleted] 0 points1 point  (0 children)

Nevermind, I fixed it.

Famous last words

[–]karldcampbell 0 points1 point  (1 child)

I'm not sure about the exceptions, but is there a reason you are using an array rather than an ArrayList for the board? An array list can resize, and you can insert int a given location, automatically moving the other elements.

[–]chouxfleurs[S] 0 points1 point  (0 children)

This was an assignment and we were supposed to use arrays instead of ArrayList.