Bug 58101

Summary: You couldn't win message...wrong sometimes in Gipsy (and perhaps in GrandFather)
Product: [Applications] kpat Reporter: gerard
Component: generalAssignee: Stephan Kulow <coolo>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 2.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: kpat_not_lost
kpat_not_lost2
Screenshot of clearly winnable game

Description gerard 2003-05-04 11:13:34 UTC
Version:           2.0 (using KDE KDE 3.1.1)
Installed from:    Compiled From Sources
OS:          Linux

When finishing the game in Gipsy, you get a message that says you cannot win.
Just close the message, and...win anyway !

It seems that the message does not take care of the new situation that comes when you did your last move, and does not take care of the "tricky" moves which can make you win as well.
Comment 1 Stephan Kulow 2003-05-05 11:08:59 UTC
for grandfather the bug is fixed in 3.1.1a, but for gypsy I haven't heard of it. Can you send 
me a saved game to reproduce? (I'm a lazy guy - and bad in finishing patiences :) 
Comment 2 gerard 2003-05-07 20:51:28 UTC
Subject: Re:  You couldn't win message...wrong sometimes in Gipsy (and perhaps in GrandFather)

Le Lundi 05 Mai 2003 11:09 AM, vous avez 
Comment 3 gerard 2003-05-07 21:19:52 UTC
Subject: Re:  You couldn't win message...wrong sometimes in Gipsy (and perhaps in GrandFather)

Le Mercredi 07 Mai 2003 08:51 PM, vous avez 
Comment 4 Stephan Kulow 2003-05-08 17:03:08 UTC
Subject: KDE_3_1_BRANCH: kdegames/kpat

CVS commit by coolo: 

code cleanup. Should fix 58101
CCMAIL: 58101-done@bugs.kde.org
(Gerard - I hope you can update and try again)


  M +27 -29    gypsy.cpp   1.12.2.1


--- kdegames/kpat/gypsy.cpp  #1.12:1.12.2.1
@@ -76,11 +76,9 @@ bool Gypsy::isGameLost() const {
         }
 
-        Card *cardi,*cnext;
-        int i, j, k, indexi;
-
-        for(i=0; i < 8; i++){
-                cnext=store[i]->top();
-                indexi=store[i]->indexOf(cnext);
+        for(int i=0; i < 8; i++) {
+            Card *cnext=store[i]->top();
+            int indexi=store[i]->indexOf(cnext);
 
+            Card *cardi= 0;
                 do{
                         cardi=cnext;
@@ -88,7 +86,7 @@ bool Gypsy::isGameLost() const {
                                 cnext=store[i]->at( --indexi );
 
-
-                        for(j=1; j <8; j++){
-                                k=(i+k) % 8;
+                for(int k=0; k <8; k++) {
+                    if (i == k)
+                        continue;
 
                                 if((cardi->value()+1 == store[k]->top()->value()) &&


Comment 5 Andy Ruddock 2004-10-28 00:01:11 UTC
Created attachment 8060 [details]
Screenshot of clearly winnable game

I'm getting this message with Klondike for version 2.2, kpatience installed
from the Debian unstable packages.