Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magnets freezes with 3x3 Tricky #17

Closed
TZornG opened this issue May 14, 2021 · 4 comments
Closed

Magnets freezes with 3x3 Tricky #17

TZornG opened this issue May 14, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@TZornG
Copy link

TZornG commented May 14, 2021

Hi Steffen,

I was playing around with the custom set-up of Magnets. I found when you try to create a game with 3x3 grid size and tricky difficulty the game freezes. The strip-clue option does not have an impact.

I also have the feeling that the battery gets drained when the app hangs. Could it be the app keeps trying to create a puzzle without time-out?

@SteffenBauer
Copy link
Owner

Hi, thanks for finding this bug. I can reproduce this via the local desktop version of magnets. The generation algorithm is indeed hanging in an endless loop for a 3x3 configuration at tricky level. Interestingly, also for 4x4 and even 4x5 tricky puzzles.

This also explains battery drain when the app freezes that way. Unfortunately, introducing a timeout is not trivial. The original SGT puzzles are designed to stay completely inside the generation loop without returning until a puzzle is successfully generated. Best way to solve this would be to move game generation to a separate thread, but there I will need to find the time to code it.

For now, I think I will quickly solve this by introducing lower size requirements for tricky puzzles, so that generation of too small tricky puzzles will be rejected.

@SteffenBauer SteffenBauer added the bug Something isn't working label May 14, 2021
@SteffenBauer
Copy link
Owner

Quick-Fix by size limits implemented in 146edd0

4x5 tricky puzzles seem to be possible anyway, so I added according lower size limits to tricky puzzles.
You can try the nightly build at release/nightly , should solve this issue for now.

@TZornG
Copy link
Author

TZornG commented May 16, 2021

Thanks for putting in the quick fix. Maybe you can still simplify it. Now you put in a series of checks on dimension level. I had to confirm the warning and change values 3 times after trying to start a 3x3 game. 3x3 -> 4x3 -> 4x4 -> 5x4.

The Android versions simply has one check/warning: "Either width or height must be at least five for Tricky".

@SteffenBauer
Copy link
Owner

SteffenBauer commented May 16, 2021

Unfortunately, this one check seems not to be sufficient enough. When I try to generate a tricky 3x6 puzzle, the generator also hangs. I think it is safest to leave the current check as it is, as it ensures that
a) both sides must be at least size 4
b) at least one side must be 5.
To avoid the annoying multiple confirmation, I will make the >5 check first, but keep the both >=4 check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants