MCPcopy Create free account
hub / github.com/dds-bridge/dds / MakeNextSimple

Method MakeNextSimple

library/src/moves/moves.cpp:519–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517}
518
519auto Moves::MakeNextSimple(const int trick, const int relHand)
520 -> MoveType const * {
521 // Don't worry about small moves. Why not, actually?
522
523 MovePlyType &list = moveList[trick][relHand];
524 if (list.current > list.last)
525 return nullptr;
526
527 const MoveType &curr = list.move[list.current];
528
529 trackp = &track[trick];
530
531 if (relHand == 0) {
532 trackp->move[0].suit = curr.suit;
533 trackp->move[0].rank = curr.rank;
534 trackp->move[0].sequence = curr.sequence;
535 trackp->high[0] = 0;
536
537 trackp->lead_suit = curr.suit;
538 } else if (curr.suit == trackp->move[relHand - 1].suit) {
539 if (curr.rank > trackp->move[relHand - 1].rank) {
540 trackp->move[relHand].suit = curr.suit;
541 trackp->move[relHand].rank = curr.rank;
542 trackp->move[relHand].sequence = curr.sequence;
543 trackp->high[relHand] = relHand;
544 } else {
545 trackp->move[relHand] = trackp->move[relHand - 1];
546 trackp->high[relHand] = trackp->high[relHand - 1];
547 }
548 } else if (curr.suit == trump) {
549 trackp->move[relHand].suit = curr.suit;
550 trackp->move[relHand].rank = curr.rank;
551 trackp->move[relHand].sequence = curr.sequence;
552 trackp->high[relHand] = relHand;
553 } else {
554 trackp->move[relHand] = trackp->move[relHand - 1];
555 trackp->high[relHand] = trackp->high[relHand - 1];
556 }
557
558 trackp->play_suits[relHand] = curr.suit;
559 trackp->play_ranks[relHand] = curr.rank;
560
561 if (relHand == 3) {
562 track[trick - 1].lead_hand = (trackp->lead_hand + trackp->high[3]) % 4;
563 }
564
565 list.current++;
566 return &curr;
567}
568
569auto Moves::Step(const int tricks, const int relHand) -> void {
570 moveList[tricks][relHand].current++;

Callers 1

make_next_simpleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected