Changeset View
Changeset View
Standalone View
Standalone View
patsolve/spidersolver.cpp
Show First 20 Lines • Show All 379 Lines • ▼ Show 20 Line(s) | 367 | if ( allowed ) { | |||
---|---|---|---|---|---|
380 | mp->pri = 8 * cont + qMax( 0, 10 - Wlen[i] ); | 380 | mp->pri = 8 * cont + qMax( 0, 10 - Wlen[i] ); | ||
381 | if ( Wlen[j] ) | 381 | if ( Wlen[j] ) | ||
382 | { | 382 | { | ||
383 | if ( SUIT( card ) != SUIT( *Wp[j] ) ) | 383 | if ( SUIT( card ) != SUIT( *Wp[j] ) ) | ||
384 | mp->pri /= 2; | 384 | mp->pri /= 2; | ||
385 | else { | 385 | else { | ||
386 | if ( conti[j]+l+1 != 13 || conti[i]>conti[j]+l ) | 386 | if ( conti[j]+l+1 != 13 || conti[i]>conti[j]+l ) | ||
387 | { | 387 | { | ||
388 | card_t card_below; | 388 | card_t card_below {}; | ||
389 | bool exists_card_below = Wlen[i] >= l + 2; | 389 | bool exists_card_below = Wlen[i] >= l + 2; | ||
390 | if (exists_card_below) { | 390 | if (exists_card_below) { | ||
391 | card_below = W[i][Wlen[i]-l-2]; | 391 | card_below = W[i][Wlen[i]-l-2]; | ||
392 | } | 392 | } | ||
393 | if ( !exists_card_below || ( exists_card_below && | 393 | if ( !exists_card_below || ((SUIT(card_below ) != SUIT(card ) || | ||
394 | ( SUIT( card_below ) != SUIT( card ) || | | |||
395 | RANK(card_below) != RANK(card) + 1 ) | 394 | RANK(card_below) != RANK(card) + 1) | ||
396 | ) | 395 | ) | ||
397 | ) | 396 | ) | ||
398 | { | 397 | { | ||
399 | foundgood = true; | 398 | foundgood = true; | ||
400 | } else { | 399 | } else { | ||
401 | toomuch++; | 400 | toomuch++; | ||
402 | mp->pri = -40; | 401 | mp->pri = -40; | ||
403 | } | 402 | } | ||
▲ Show 20 Lines • Show All 202 Lines • ▼ Show 20 Line(s) | 604 | { | |||
606 | if ( m.from >= 10 ) | 605 | if ( m.from >= 10 ) | ||
607 | return MoveHint(); | 606 | return MoveHint(); | ||
608 | 607 | | |||
609 | PatPile *frompile = deal->stack[m.from]; | 608 | PatPile *frompile = deal->stack[m.from]; | ||
610 | 609 | | |||
611 | if ( m.totype == O_Type ) | 610 | if ( m.totype == O_Type ) | ||
612 | { | 611 | { | ||
613 | return MoveHint(); // the move to the legs is fully automated | 612 | return MoveHint(); // the move to the legs is fully automated | ||
614 | return MoveHint( frompile->topCard(), deal->legs[0], m.pri ); // for now | | |||
615 | } | 613 | } | ||
616 | 614 | | |||
617 | Q_ASSERT( m.from < 10 && m.to < 10 ); | 615 | Q_ASSERT( m.from < 10 && m.to < 10 ); | ||
618 | 616 | | |||
619 | KCard *card = frompile->at( frompile->count() - m.card_index - 1); | 617 | KCard *card = frompile->at( frompile->count() - m.card_index - 1); | ||
620 | 618 | | |||
621 | Q_ASSERT( m.to < 10 ); | 619 | Q_ASSERT( m.to < 10 ); | ||
622 | return MoveHint( card, deal->stack[m.to], m.pri ); | 620 | return MoveHint( card, deal->stack[m.to], m.pri ); | ||
623 | } | 621 | } |