Bug 59136

Summary: Forty and Eight says "you cannot win" when I can
Product: [Applications] kpat Reporter: Josh Metzler <joshdeb>
Component: generalAssignee: Stephan Kulow <coolo>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Josh Metzler 2003-05-30 04:42:58 UTC
Version:            (using KDE KDE 3.1.2)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc 3.3 
OS:          Linux

I have been playing Forty and Eight recently.  It often says "you cannot win" or something like that, when I actually can.  At these times, I am able to move the top card on the horizontal pile onto one of the other 8 piles.

I have donwloaded the latest source from WebCVS, found the bug, and created a simple one-liner patch:

--- old/fortyeight.cpp  2003-05-29 22:30:36.000000000 -0400
+++ new/fortyeight.cpp  2003-05-29 22:30:47.000000000 -0400
@@ -151,7 +151,7 @@ bool Fortyeight::isGameLost() const{
                return false;
        if(!pile->isEmpty())
                if(pile->top()->suit() == c->suit() &&
-                       pile->top()->value()-1 == c->value())
+                       pile->top()->value()+1 == c->value())
                        return false;
        for(int j=0; j <8;j++){
                if(target[j]->isEmpty())

It was checking to see if one of the eight piles was one lower than the top card in the horizontal pile, but it should check for one higher.

Josh
Comment 1 Stephan Kulow 2003-06-02 10:07:30 UTC
Subject: KDE_3_1_BRANCH: kdegames/kpat

CVS commit by coolo: 

fixing isGameLost
CCMAIL: 59136-done@bugs.kde.org


  M +1 -1      fortyeight.cpp   1.16.2.2


--- kdegames/kpat/fortyeight.cpp  #1.16.2.1:1.16.2.2
@@ -153,5 +153,5 @@ bool Fortyeight::isGameLost() const{
         if(!pile->isEmpty())
                 if(pile->top()->suit() == c->suit() &&
-                        pile->top()->value()-1 == c->value())
+                        pile->top()->value()+1 == c->value())
                         return false;
         for(int j=0; j <8;j++){