Back to Today's Deal

Is my puzzle solvable?


#1

I am making a simple puzzle. I remeber in my youth that I encountered a 9x9 tray where a piece is missing and you have to move around so that the puzzle fits with each other. I’ve made my own variant and it should add all bits randomly. But I have encountered a combo that I cannot solve, either I lack the puzzel knowledge or it’s a variant that cannot be solved.

Please try. It should be 1-9 where the first row is 1,2,3, then 4, 5, 6 (with 5 is gone so it should be empty)

http://skerp.se/puzzle/

You get a message if you passed it.

Can’t solve it myself. :frowning:


#3

So I used a website to analyse the puzzle before having a crack (didn’t want to waste time if it is not solvable) and it indeed says that this puzzle is not solvable. http://analogbit.com/software/puzzletools/ if you want to check it out.


#4

Interesting! Thanks for the link! Then I know! So then I can’t make my puzzle to randomize the pieces. :frowning:


#5

I would suggest you have two options:
Write a test harness that attempts to solve the puzzle after it’s been created randomly, that way you can still create them randomly and then your harness will discard any that can’t be solved.
If that sounds like too much work, you could leverage the website that @PeteMcc linked, submit your generated puzzle, capture the response and use that.


#6

You can also start the puzzle in a solved stated, and randomly disorganize it following your rules on how it should be solved, like a Rubik cube.


#7

I was thinking if you could check some pieces and if they are on x spot or next to x block. But how would I know which to look for?


#8

That’s also a good option, I was thinking seeing as he already had a process for randomly generating the puzzle to carry on down that line.

Whichever you choose @Terzom I’d suggest also adding a counter for every move and setting a threshold for how difficult you want the puzzle to be.
It also means you can add difficulty levels in future.


#9

To randomize puzzles like this, you can start with the puzzle in a solved state, and then make a number of random legal moves. That way, solvability is guaranteed.

To keep the puzzle from being too easy, you can constrain these moves, to e.g. make sure you avoid pairs of moves that undo each other, or employ some difficulty metric that stops the randomization when the puzzle is deemed difficult enough.