chrisboyle / sgtpuzzles

Android port of Simon Tatham's Puzzles
https://chris.boyle.name/puzzles
Other
603 stars 168 forks source link

Cannot disable Jigsaw mode in custom Solo configurations #439

Closed me-and closed 2 years ago

me-and commented 6 years ago

The Solo custom configuration box is unintuitive in when enabling/disabling "Jigsaw" mode:

  1. Open Solo, select one of the standard types from the Type drop-down, e.g. 3x3 Basic.
  2. Open the Type drop-down again, select Custom..., put a check in Jigsaw, and tap OK. As expected, you get a new game in Jigsaw mode.
  3. Open the the custom type dialog again, untick Jigsaw, then tap OK. I'd expect to get a 3x3 non-jigsaw game, but instead get another 3x3 jigsaw game; re-opening the custom type dialog another time still has the Jigsaw tickbox ticked.

It looks like the problem here is that, at the end of step 2, the game stores 3x3 Jigsaw as 9x1. Certainly if you're paying attention (which I wasn't when this caught me out), when you open the custom type dialog the second and subsequent times, the columns x rows configuration has changed from 3x3 to 9x1. Attempting to uncheck Jigsaw while the size is still 9x1 doesn't work.

You can work around this behaviour – assuming you spot that's what's going on – by explicitly reconfiguring the size as 3x3, at which point unchecking Jigsaw works as expected. Nonetheless I'd expect checking then unchecking the Jigsaw button to have no effect on any other configuration.

me-and commented 6 years ago

I'd assumed this was a bit of Android-specific interface, but it looks like the upstream JavaScript version has the same behaviour.

ostrosablin commented 5 years ago

I confirm this for Linux desktop port as well. Looks like this is a common upstream bug.

ostrosablin commented 5 years ago

Looking at the puzzle code, setting Jigsaw mode indeed manipulates sub-block columns/rows settings. There's no separate state variable, controlling Jigsaw mode. By setting it, rows are set to 1, and columns become a multiply of rows x columns (e.g. 9 for 3x3).

This seems to be a hack to avoid intoducing separate variable. You can also put game into Jigsaw mode without Jigsaw checkbox, e.g. by setting in to 9x1, but leaving Jigsaw unchecked. But I agree this is not an expected behavior and looks more like a hack.