Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sliding Puzzle Out Of Bounds Execption  RSS feed

 
Duarte Pereira Silva
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I keep getting the out of bounds error in some of the movements i do please help

Main Class


GUI

 
Carey Brown
Bartender
Posts: 2995
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please post a cut&past of the error message here?
 
Carey Brown
Bartender
Posts: 2995
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't look like you range check 'y-1', 'y+1', etc..
 
Campbell Ritchie
Marshal
Posts: 55717
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is something else wrong with that code; the repeated use of the == operator. I think the chances of any of those ifs being executed are slim, because those == operators will probably all return false, unless the indices are the same.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!