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

Method build_path

library/src/trans_table/trans_table_s.cpp:700–845  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698
699
700auto TransTableS::build_path(
701 const int win_mask_[],
702 const int win_order_set[],
703 const int u_bound,
704 const int l_bound,
705 const char best_move_suit,
706 const char best_move_rank,
707 PosSearchSmall * node_ptr,
708 bool& result) -> NodeCards *
709{
710 /* If result is TRUE, a new SOP has been created and build_path returns a
711 pointer to it. If result is FALSE, an existing SOP is used and build_path
712 returns a pointer to the SOP */
713
714 bool found;
715 WinCard * np, *p2, *nprev;
716 NodeCards *p;
717
718 np = node_ptr->pos_search_point_;
719 nprev = nullptr;
720 int suit = 0;
721
722 /* If winning node has a card that equals the next winning card deduced
723 from the position, then there already exists a (partial) path */
724
725 if (np == nullptr)
726 {
727 /* There is no winning list created yet */
728 /* Create winning nodes */
729 p2 = &(win_cards_[win_set_size_]);
730 add_win_set();
731 p2->next_ = nullptr;
732 p2->next_win_ = nullptr;
733 p2->prev_win_ = nullptr;
734 node_ptr->pos_search_point_ = p2;
735 p2->win_mask_ = win_mask_[suit];
736 p2->order_set_ = win_order_set[suit];
737 p2->first_ = nullptr;
738 np = p2; /* Latest winning node */
739 suit++;
740 while (suit < DDS_SUITS)
741 {
742 p2 = &(win_cards_[win_set_size_]);
743 add_win_set();
744 np->next_win_ = p2;
745 p2->prev_win_ = np;
746 p2->next_ = nullptr;
747 p2->next_win_ = nullptr;
748 p2->win_mask_ = win_mask_[suit];
749 p2->order_set_ = win_order_set[suit];
750 p2->first_ = nullptr;
751 np = p2; /* Latest winning node */
752 suit++;
753 }
754 p = &(node_cards_[node_set_size_]);
755 add_node_set();
756 np->first_ = p;
757 result = true;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected