Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does this game have a solution

Tags:

java

swing

I am developing a simple game using Java swing. I want to know whether this particular game has a solution in the following scenario. If I am convinced that theoretically a solution cannot be arrived at this point, I will throw a notification to the user.

3x3
http://img814.imageshack.us/img814/7449/screenshot20100924at206.png

4x4
http://img39.imageshack.us/img39/1851/screenshot20100924at241.png

The objective of this game is to fill numbers from 1 to 8 (or 1 to 15) using the one space available to push the numbers to that empty space. Every time I end up with the combination shown above. I just want to convince myself that there is no way to attain the proper solution from the above scenario. Please help.

EDIT : Solution has been posted at here and here

like image 654
bragboy Avatar asked Sep 23 '10 20:09

bragboy


1 Answers

Yes, and no. If you generate the numbers randomly, I believe that there is a situation that could occur that causes the puzzle to be unsolvable. The way I'd suggest generating a puzzle is starting with the solved puzzle, and executing a number (increasing based on difficulty) of moves in reverse. That way you know that the end puzzle is solvable.

like image 70
Drew McGhie Avatar answered Sep 19 '22 12:09

Drew McGhie