Bug 469991

Summary: Hints are not working correctly in the Freecell game mode
Product: [Applications] kpat Reporter: winblocker
Component: solverAssignee: Stephan Kulow <coolo>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, anna, kde-games-bugs-null, sjurberengal+kde
Priority: NOR    
Version First Reported In: 23.04.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: wrong highlight

Description winblocker 2023-05-19 11:43:02 UTC
Created attachment 159099 [details]
wrong highlight

SUMMARY

Using the "Hint" feature highlights all cards instead of the appropriate in the "Freecell" game mode.


STEPS TO REPRODUCE
1. Open kpat
2. Select "Freecell" game mode
3. Press "H" for hint

OBSERVED RESULT
All cards are highlighted

EXPECTED RESULT
Only logical steps provided by the solver should be highlighted

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9
Kernel Version: 6.3.2-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 5950X 16-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 6900 XT

ADDITIONAL INFORMATION
Comment 1 Albert Astals Cid 2023-05-19 14:03:24 UTC
Stephan, git bisect says that https://invent.kde.org/games/kpat/-/commit/f15e0e5f767beb1c2d6f2ea0b32ef4610b3fc994 is what broke it.

Can you have a look?
Comment 2 Stephan Kulow 2023-05-19 19:56:52 UTC
469368 liked it! :)
Comment 3 Stephan Kulow 2023-06-10 11:55:43 UTC
This is trickier than I thought. Freecell solvers will basically only emit hints from winning moves and people expect this by now. But I can't implement this globally as most other games/solvers are just too slow to wait for them.

But I reverted the regression and fixed simple simon autodrop differently: https://invent.kde.org/games/kpat/-/merge_requests/50
Comment 4 Stephan Kulow 2023-06-10 12:12:17 UTC
*** Bug 469082 has been marked as a duplicate of this bug. ***
Comment 5 Stephan Kulow 2023-06-10 12:12:50 UTC
*** Bug 468933 has been marked as a duplicate of this bug. ***
Comment 6 Albert Astals Cid 2023-06-12 21:25:04 UTC
Git commit cc62c5599a7bd586ec94f874ab89efc50253d60c by Albert Astals Cid, on behalf of Stephan Kulow.
Committed on 12/06/2023 at 21:24.
Pushed by aacid into branch 'master'.

Solve the simple simon autodrop problem less aggressively

Using the brute force algorithm for auto drop has several drawbacks
that users reported:
  - it's too aggressive (didn't matter for simple simon when I implemented
    it, as there is only one kind of foundation move)
  - the hint function is no longer a way to cheat your scores, you actually
    need to pick the winning move yourself

So revert that part and make in return the simple simon solver more useful
for autodrop by providing the right priority for foundation moves. In addition
I had to make sure we always return a first move even if the old interface
is not implemented.

M  +0    -5    src/dealer.cpp
M  +12   -2    src/patsolve/abstract_fc_solve_solver.cpp
M  +1    -1    src/patsolve/abstract_fc_solve_solver.h
M  +4    -2    src/patsolve/simonsolver.cpp
M  +0    -15   src/patsolve/simonsolver.h

https://invent.kde.org/games/kpat/-/commit/cc62c5599a7bd586ec94f874ab89efc50253d60c
Comment 7 Albert Astals Cid 2023-06-12 21:39:25 UTC
Git commit 31aa7a28cb63c9d7be35371a63ec2f481bec6efe by Albert Astals Cid, on behalf of Stephan Kulow.
Committed on 12/06/2023 at 21:38.
Pushed by aacid into branch 'release/23.04'.

Solve the simple simon autodrop problem less aggressively

Using the brute force algorithm for auto drop has several drawbacks
that users reported:
  - it's too aggressive (didn't matter for simple simon when I implemented
    it, as there is only one kind of foundation move)
  - the hint function is no longer a way to cheat your scores, you actually
    need to pick the winning move yourself

So revert that part and make in return the simple simon solver more useful
for autodrop by providing the right priority for foundation moves. In addition
I had to make sure we always return a first move even if the old interface
is not implemented.
(cherry picked from commit cc62c5599a7bd586ec94f874ab89efc50253d60c)

M  +0    -5    src/dealer.cpp
M  +12   -2    src/patsolve/abstract_fc_solve_solver.cpp
M  +1    -1    src/patsolve/abstract_fc_solve_solver.h
M  +4    -2    src/patsolve/simonsolver.cpp
M  +0    -15   src/patsolve/simonsolver.h

https://invent.kde.org/games/kpat/-/commit/31aa7a28cb63c9d7be35371a63ec2f481bec6efe