From kde-commits Wed Jan 26 10:11:44 2011 From: Stephan Kulow Date: Wed, 26 Jan 2011 10:11:44 +0000 To: kde-commits Subject: KDE/kdegames/kpat/patsolve Message-Id: <20110126101144.E49CEAC8BA () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=129603675529208 SVN commit 1217190 by coolo: find more hints to solve more games BUG: 185211 M +3 -3 patsolve.cpp M +8 -6 spidersolver.cpp --- trunk/KDE/kdegames/kpat/patsolve/patsolve.cpp #1217189:1217190 @@ -563,20 +563,20 @@ if (l == NULL) { if (Pilenum >= NPILES ) { Status = UnableToDetermineSolvability; - qDebug() << "out of piles"; + //qDebug() << "out of piles"; return -1; } l = mm_allocate(BUCKETLIST); if (l == NULL) { Status = UnableToDetermineSolvability; - qDebug() << "out of buckets"; + //qDebug() << "out of buckets"; return -1; } l->pile = new_array(quint8, Wlen[w] + 1); if (l->pile == NULL) { Status = UnableToDetermineSolvability; MemoryManager::free_ptr(l); - qDebug() << "out of memory"; + //qDebug() << "out of memory"; return -1; } --- trunk/KDE/kdegames/kpat/patsolve/spidersolver.cpp #1217189:1217190 @@ -298,8 +298,10 @@ if ( l > 0 ) { card_t card_on_top = W[i][Wlen[i]-l]; - if ( RANK( card ) != RANK( card_on_top ) + 1 ) + //printcard(card_on_top, stderr); + if ( RANK( card ) != RANK( card_on_top ) + 1 ) { break; + } if ( SUIT( card ) != SUIT( card_on_top ) ) break; } @@ -381,7 +383,7 @@ if ( conti[j]+l+1 != 13 || conti[i]>conti[j]+l ) { card_t card_below = W[i][Wlen[i]-l-2]; - if ( SUIT( card_below ) != SUIT( card ) ) + if ( SUIT( card_below ) != SUIT( card ) || RANK(card_below) != RANK(card) + 1 ) { foundgood = true; } else { @@ -401,19 +403,19 @@ mp->pri = qMin( 127, mp->pri + 2 ); /* and now check what sequence we open */ - int conti_pos = l+1; + int conti_pos = l; for ( ; conti_pos < Wlen[i]-1; ++conti_pos ) { - card_t top = W[i][Wlen[i]-l-2]; card_t theone = W[i][Wlen[i]-conti_pos-1]; card_t below = W[i][Wlen[i]-conti_pos-2]; #if 0 - printcard( top, stderr ); + fprintf(stderr, "checking pile%d len:%d prio:%d ", i, l, mp->pri); + printcard( card, stderr ); printcard( theone, stderr ); printcard( below, stderr ); fputc( '\n', stderr ); #endif - if ( SUIT( top ) != SUIT( below ) || DOWN( below ) ) + if ( SUIT( card ) != SUIT( below ) || DOWN( below ) ) break; if ( RANK( theone ) != RANK( below ) - 1)