applets/fifteenpuzzle: don't shuffle into a solved puzzle
When reshuffling the board, it's possible to immediately get an already solved puzzle. It's very unlikely for realistic board sizes, but can be triggered somewhat if you refresh a 2×2 board often for some reason.
We might as well make sure it never happens. To do this easily, we convert the existing solution checker into a function with return value, rather than always immediately marking the board as solved if it is, and use that to reshuffle if needed.