Bug 290647

Summary: Forty & Eight solver falsely reports "Game cannot be won"
Product: [Applications] kpat Reporter: Duncan Kinnear <duncan>
Component: solverAssignee: Ian Wadham <iandw.au>
Status: ASSIGNED ---    
Severity: normal CC: andrew.crouthamel, ckjunk1, iandw.au, kde-games-bugs, saurv4u
Priority: NOR    
Version: 3.5.1   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Proof that I did win the game!
Saved game at the point where the solver 'cheated'
Screenshot showing the illegal move highlighted in the Hints
Another saved game with illegal 2-card hint
Illegal 2-card move shown in the highlighted hints
False report of "Game cannot be won"
Image of cards in the saved game - att. 130719
Image of winnability of the saved game - att. 130719

Description Duncan Kinnear 2012-01-04 23:48:31 UTC
Created attachment 67468 [details]
Proof that I did win the game!

Version:           3.5.1 (using KDE 4.6.5) 
OS:                Linux

What can I say? It's a quiet week!

"Forty & Eight" game 1397386676.

Went thru first draw from pack and during re-draw from pack, solver said "This game cannot be won". However, it looked quite hopeful (and it's done this to me before) so I carried on and after about 5 moves it said "This game is winnable" and I went on to win it.

Reproducible: Didn't try

Steps to Reproduce:
Try that specific game


Expected Results:  
Should say that game is winnable
Comment 1 Duncan Kinnear 2012-01-04 23:53:39 UTC
A bit more info. I got "game cannot be won" several times and used 'undo' to get back to "cannot determine if this game is winnable", but the last time it said it, I did not use undo, but carried on to win.
Comment 2 Parker Coates 2012-01-20 14:05:22 UTC
Thanks for the report, but if you're able to reproduce the issue, could you
please attach a saved game demonstrating the issue? This makes it much easier
for developers to recreate the scenario.
Comment 3 Andrew Crouthamel 2018-11-06 15:07:22 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Duncan Kinnear 2018-11-06 19:29:43 UTC
Hi there, I play this game (version 3.6) almost every day, and it quite often reports "This game cannot be won" and I never trust it, and occasionally it's wrong and I can win it.

I will try saving each game of "Forty & Eight" I play and if this scenario comes up I'll attach the saved game.

It's certainly not a biggie. :-)
Comment 5 Ian Wadham 2018-11-07 00:22:38 UTC
Like Duncan, I play Forty and Eight a lot... :-) ...and get this same bug.

FWIW the solver sometimes also gives false positives re winning. I think this happens when its "winning" sequence includes an illegal move. I can overcome that by using Undo and then one or two moves of Demo to get past the illegal move and go on to win... ;-) i.e. Demo permits the same illegal move as solver.

IIRC the illegal move is to move two cards that are not consecutive, although (I seem to remember) the two cards are in the same suit.

I doubt now if I shall ever get around to having a go at fixing these bugs, but if you are interested, Parker, I could try and capture more details next time it happens. It's nice to see you around again... :-)
Comment 6 Andrew Crouthamel 2018-11-07 08:33:10 UTC
Thanks for the update!
Comment 7 Duncan Kinnear 2018-11-12 00:44:54 UTC
Created attachment 116252 [details]
Saved game at the point where the solver 'cheated'

I have attached a saved game file for "Forty & Eight" at the point that the Solver said it was winnable, and the next move that the demo solver uses is illegal (2-card transfer).
I will attach screenshot before this move showing the hints.
Comment 8 Duncan Kinnear 2018-11-12 00:46:02 UTC
Created attachment 116253 [details]
Screenshot showing the illegal move highlighted in the Hints
Comment 9 Duncan Kinnear 2018-11-13 03:39:22 UTC
Created attachment 116272 [details]
Another saved game with illegal 2-card hint

Another day, another game, same fault. :-)
I will also attach the screenshot showing the illegal move hint
Comment 10 Duncan Kinnear 2018-11-13 03:40:27 UTC
Created attachment 116273 [details]
Illegal 2-card move shown in the highlighted hints

Illegal 2-card move shown in the highlighted hints
Comment 11 Ian Wadham 2020-07-19 04:16:07 UTC
*** Bug 351989 has been marked as a duplicate of this bug. ***
Comment 12 Ian Wadham 2020-07-19 04:18:39 UTC
*** Bug 374440 has been marked as a duplicate of this bug. ***
Comment 13 Ian Wadham 2020-07-19 04:42:39 UTC
I know how to fix this problem --- patches are being prepared.

Actually there are two problems. The first is where the Forty & Eight solver fails to report both cards as possible moves when there are two cards of the same suit and rank that can "go out" onto a Foundation pile. The second is that, even if both cards are reported to the generic solver and Hint action, Autodrop plays the first one in the list onto the Foundation, thus making the second card unplayable. That card might be a winner and the first card might be a loser or either card might at least be a better or preferred move, which would improve your chances of winning.
Comment 14 Ian Wadham 2020-08-08 04:28:16 UTC
Created attachment 130719 [details]
False report of "Game cannot be won"

Saved KPatience game - can be used as a test case for this bug (290647).
Comment 15 Ian Wadham 2020-08-08 04:40:54 UTC
Created attachment 130720 [details]
Image of cards in the saved game - att. 130719

In this image, the 4 of Diamonds has just been played to a Foundation pile. There are now two 5s of Diamonds that can be played next, but the Solver and Autodrop always choose the one on the left (as shown in the highlighting of the Hint). This leads to a "no win" situation. If the 5 of Diamonds on the right is played, winnability becomes undetermined, but about 20 moves later the Solver finds that the game is winnable.
Comment 16 Ian Wadham 2020-08-08 04:48:45 UTC
Created attachment 130721 [details]
Image of winnability of the saved game - att. 130719

This is an image of the same game as in image 130720, but about 20 moves later, after the 5 of Diamonds on the right has been played. The game is now designated as solvable, contradicting what the Solver said before.