示例#1
0
static void
sdic_sort (void)
{
  if (!Sorted ((char *) jeary, (int) jt.maxserial, sizeof (struct je *), sort_func_sdic))
    {
      qsort ((char *) jeary, (int) jt.maxserial, sizeof (struct je *), sort_func_sdic);
    }
}
示例#2
0
std::vector<Card> Hand::HighCard()
{
    std::vector<Card> sortedHand = Sorted();
    std::vector<Card> cards;

    if(sortedHand.size())
        cards.push_back(sortedHand[sortedHand.size() - 1]);

    return cards;
}
示例#3
0
std::vector<Card> Hand::Straight()
{
    std::vector<Card> sortedHand = Sorted();
    std::vector<Card> cards;

    if(sortedHand.size() == 5)
        if(StraightBetween(sortedHand, 0, 5))
        {
            cards.push_back(sortedHand[0]);
            cards.push_back(sortedHand[1]);
            cards.push_back(sortedHand[2]);
            cards.push_back(sortedHand[3]);
            cards.push_back(sortedHand[4]);
        }

    if(sortedHand.size() == 6)
        if(StraightBetween(sortedHand, 1, 6))
            if(cards.size())
                cards.push_back(sortedHand[5]);
            else
            {
                cards.push_back(sortedHand[1]);
                cards.push_back(sortedHand[2]);
                cards.push_back(sortedHand[3]);
                cards.push_back(sortedHand[4]);
                cards.push_back(sortedHand[5]);
            }

    if(sortedHand.size() == 7)
        if(StraightBetween(sortedHand, 2, 7))
            if(cards.size())
            {
                cards.push_back(sortedHand[6]);
                if(!FindCard(sortedHand[5], cards))
                    cards.push_back(sortedHand[5]);
            }
            else
            {
                cards.push_back(sortedHand[2]);
                cards.push_back(sortedHand[3]);
                cards.push_back(sortedHand[4]);
                cards.push_back(sortedHand[5]);
                cards.push_back(sortedHand[6]);
            }

    return cards;
}