int main( void )
{
    CardMask cards;
    HandVal handval1, handval2;
    EvxHandVal evxHandVal;

    ENUMERATE_5_CARDS(cards,
    {
        handval1 = Hand_EVAL_N(cards, 5);
        evxHandVal = Hand_EVAL_X5(CardMask_CLUBS(cards),
        CardMask_DIAMONDS(cards),
        CardMask_HEARTS(cards),
        CardMask_SPADES(cards));
        handval2 = EvxHandVal_toHandVal(evxHandVal);
        if (handval1 != handval2)
        {
            fprintf(stderr, "eval_n() and eval_x5() disagree\n");
            printf("0\n");
            Deck_printMask(cards);
            printf(": ");
            HandVal_print(handval1);
            printf(", ");
            HandVal_print(handval2);
            printf("\n");
            exit(0);
        }

        printf("%d %d %d %d %d %d\n",
        HandVal_HANDTYPE(handval1),
        HandVal_TOP_CARD(handval1),
        HandVal_SECOND_CARD(handval1),
        HandVal_THIRD_CARD(handval1),
        HandVal_FOURTH_CARD(handval1),
        HandVal_FIFTH_CARD(handval1));
    });
Example #2
0
    uint32 CollaspeCardMask(CardMask cards)
    {
        uint32 ss = CardMask_SPADES(cards);
        uint32 sc = CardMask_CLUBS(cards);
        uint32 sd = CardMask_DIAMONDS(cards);
        uint32 sh = CardMask_HEARTS(cards);

        return (sc | sd | sh | ss);
    }
Example #3
0
int main( void )
{
  CardMask cards, cards1, peggedCards;
  HandVal handval1, handval2;
  EvxHandVal evxHandVal;

  StdDeck_CardMask_RESET(peggedCards);
  StdDeck_CardMask_SET(peggedCards, 
                       StdDeck_MAKE_CARD(StdDeck_Rank_ACE, 
                                         StdDeck_Suit_DIAMONDS));
  StdDeck_CardMask_SET(peggedCards, 
                       StdDeck_MAKE_CARD(StdDeck_Rank_ACE, 
                                         StdDeck_Suit_HEARTS));
  ENUMERATE_5_CARDS_D(cards, peggedCards, 
                    {
                      StdDeck_CardMask_OR(cards1, cards, peggedCards);
                      handval1 = Hand_EVAL_N(cards1, 7);
                      evxHandVal = Hand_EVAL_X7(CardMask_CLUBS(cards1), 
                                                CardMask_DIAMONDS(cards1),
                                                CardMask_HEARTS(cards1),
                                                CardMask_SPADES(cards1));
                      handval2 = EvxHandVal_toHandVal(evxHandVal);
                      if (handval1 != handval2)
                        {
                          fprintf(stderr, "eval_n() and eval_x7() disagree\n");
                          printf("0\n");
                          Deck_printMask(cards);                        
                          printf(": ");                                 
                          HandVal_print(handval1);                  
                          printf(", ");
                          HandVal_print(handval2);                  
                          printf("\n");                                 
                          exit(0);
                        }
		      printf("%d %d %d %d %d %d\n", 
			     HandVal_HANDTYPE(handval1),
			     HandVal_TOP_CARD(handval1),
			     HandVal_SECOND_CARD(handval1),
			     HandVal_THIRD_CARD(handval1),
			     HandVal_FOURTH_CARD(handval1),
			     HandVal_FIFTH_CARD(handval1));
                    });
Example #4
0
int main( void )
{
  CardMask cards;
  HandVal handval1, handval2;
  EvxHandVal evxHandVal;
  Md5Context ctx;
  Md5RawDigest raw;
  Md5CodedDigest coded;
  unsigned char hashvals[6];

  ctx = MD5Begin();
  ENUMERATE_5_CARDS(cards, 
                    {
                      handval1 = Hand_EVAL_N(cards, 5);
                      evxHandVal = Hand_EVAL_X5(CardMask_CLUBS(cards), 
                                                CardMask_DIAMONDS(cards),
                                                CardMask_HEARTS(cards),
                                                CardMask_SPADES(cards));
                      handval2 = EvxHandVal_toHandVal(evxHandVal);
                      if (handval1 != handval2)
                        {
                          fprintf(stderr, "eval_n() and eval_x5() disagree\n");
                          printf("0\n");
                          Deck_printMask(cards);                        
                          printf(": ");                                 
                          HandVal_print(handval1);                  
                          printf(", ");
                          HandVal_print(handval2);                  
                          printf("\n");                                 
                          exit(0);
                        }
                      
                      hashvals[0] = HandVal_HANDTYPE(handval1);
                      hashvals[1] = HandVal_TOP_CARD(handval1);
                      hashvals[2] = HandVal_SECOND_CARD(handval1);
                      hashvals[3] = HandVal_THIRD_CARD(handval1);
                      hashvals[4] = HandVal_FOURTH_CARD(handval1);
                      hashvals[5] = HandVal_FIFTH_CARD(handval1);
                      MD5DigestBytes(ctx, hashvals, 6);
                    });