Bug 470393

Summary: Solver for mod3 incorrectly states the game is no longer winnable
Product: [Applications] kpat Reporter: joppyfurr
Component: solverAssignee: Stephan Kulow <coolo>
Status: RESOLVED FIXED    
Severity: normal CC: kde-games-bugs-null
Priority: NOR    
Version First Reported In: 23.04.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Save game, one move before the bug is seen
01 - Winnable
02 - Not winnable after moving the 6 of Diamonds
03 - Winnable again after moving the Jack of Diamonds

Description joppyfurr 2023-05-29 04:40:46 UTC
Created attachment 159309 [details]
Save game, one move before the bug is seen

SUMMARY

Playing a game, I have noticed the solver states a game is no longer winnable, and then becomes winnable again after moving another card.

Save is attached.


STEPS TO REPRODUCE
1. Load the save
2. Move the 6 of Diamonds onto the 3 of Diamonds, observe the solver declare the game no longer winnable.
3. Move the Jack of diamonds into a free space, observe the solver declare the game winnable again

OBSERVED RESULT
As described in the reproduction steps, the game is briefly declared no longer winnable.
I will attach screenshots.

EXPECTED RESULT
The game should not be declared no longer winnable, as it can be won.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9

ADDITIONAL INFORMATION
Comment 1 joppyfurr 2023-05-29 04:42:03 UTC
Created attachment 159310 [details]
01 - Winnable
Comment 2 joppyfurr 2023-05-29 04:42:35 UTC
Created attachment 159311 [details]
02 - Not winnable after moving the 6 of Diamonds
Comment 3 joppyfurr 2023-05-29 04:43:03 UTC
Created attachment 159312 [details]
03 - Winnable again after moving the Jack of Diamonds
Comment 4 Stephan Kulow 2023-06-10 06:44:16 UTC
Please provide save games - screen shots are fun to watch, but don't help me to reproduce the problem.
Comment 5 joppyfurr 2023-06-11 01:50:55 UTC
The very first attachment is a save game, it was the first thing I uploaded.
Comment 6 Stephan Kulow 2023-06-17 11:57:29 UTC
no idea how I managed to overlook that.
Comment 7 Bug Janitor Service 2023-06-17 12:50:00 UTC
A possibly relevant merge request was started @ https://invent.kde.org/games/kpat/-/merge_requests/51
Comment 8 Stephan Kulow 2023-06-17 12:54:47 UTC
With clearing the field in row 2 you enabled the greed mode of the solver and it ignored all common sense. Removed that optimization now, which leads to more game states where you'll see 'unable to determine' - but better unsure than wrong.
Comment 9 Albert Astals Cid 2023-06-18 21:40:05 UTC
Git commit 4e54e3de211f80c35841b87df5670156aa7a22d4 by Albert Astals Cid, on behalf of Stephan Kulow.
Committed on 18/06/2023 at 21:38.
Pushed by aacid into branch 'master'.

Remove optimization from mod3 solver that doesn't hold true in all cases

Just like in bug 337950 the opimization to ignore last row moves if there
is a target move is premature and harmful. So remove it for good.

M  +0    -17   src/patsolve/mod3solver.cpp

https://invent.kde.org/games/kpat/-/commit/4e54e3de211f80c35841b87df5670156aa7a22d4