Esempio n. 1
0
static void 
doTopFiveCardsTable(void) {
  int i, j, card;

  MakeTable_begin("topFiveCardsTable", 
                  T5C_FILENAME, 
                  "uint32", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(T5C_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) {
    HandVal eval;
    int n = i;

    eval = 0;
    for (j=0; j<5; j++) {
      eval <<= HandVal_CARD_WIDTH;
      card = top_card_func(n);
      eval += card;
      n &= ~(1 << card);
    };

    MakeTable_outputUInt32(eval);
  };

  MakeTable_end();
}
Esempio n. 2
0
static void 
doMaskRankTable(void) {
  int i;

  MakeTable_begin("StdDeck_maskRankTable", 
                  MR_FILENAME, 
                  "StdDeck_CardMask", 
                  StdDeck_Rank_COUNT);
  MakeTable_comment(MR_COMMENT_STRING);
  for (i=0; i < StdDeck_Rank_COUNT; i++) {
    StdDeck_CardMask c;

    StdDeck_CardMask_RESET(c);
    c.cards.spades   = (1 << i);
    c.cards.hearts   = (1 << i);
    c.cards.diamonds = (1 << i);
    c.cards.clubs    = (1 << i);

#ifdef HAVE_INT64
    MakeTable_outputUInt64(~c.cards_n);
#else
    { 
      char buf[80];
      sprintf(buf, " { { 0x%08x, 0x%08x } } ", ~c.cards_nn.n1, ~c.cards_nn.n2);
      MakeTable_outputString(buf);
    };
#endif
  };

  MakeTable_end();
}
Esempio n. 3
0
static void 
doPairValueTable(void) {
  int i;

  MakeTable_begin("evxPairValueTable", 
                  PV_FILENAME, 
                  "uint32", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(PV_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) {
    uint32 retval, cards, temp;

    cards = i;
    retval = top_bit_func(cards);
    cards ^= retval;
    temp = top_bit_func(cards);
    retval ^= temp;
    cards ^= temp;
    retval |= top_bit_func(cards) 
              | EvxHandVal_ONEPAIR;

    MakeTable_outputUInt32(retval);
  };

  MakeTable_end();
}
Esempio n. 4
0
static void 
doTopBitTable(void) {
  int i;

  MakeTable_begin("topBitTable", 
                  TB_FILENAME, 
                  "uint32", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(TB_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) 
    MakeTable_outputUInt32(top_bit_func(i));

  MakeTable_end();
}
Esempio n. 5
0
static void 
doTopCardTable(void) {
  int i;

  MakeTable_begin("topCardTable", 
                  TC_FILENAME, 
                  "uint8", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(TC_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) 
    MakeTable_outputUInt8(top_card_func(i));

  MakeTable_end();
}
Esempio n. 6
0
static void 
doNBitsTable(void) {
  int i;

  MakeTable_begin("nBitsTable", 
                  NB_FILENAME, 
                  "uint8", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(NB_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) 
    MakeTable_outputUInt8(n_bits_func(i));

  MakeTable_end();
}
Esempio n. 7
0
static void 
doStraightTable(void) {
  int i;

  MakeTable_begin("straightTable", 
                  ST_FILENAME, 
                  "uint8", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(ST_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) 
    MakeTable_outputUInt8(straight_func(i));

  MakeTable_end();
}
Esempio n. 8
0
static void 
doFlushCardsTable(void) {
  int i;

  MakeTable_begin("evxFlushCardsTable", 
                  FC_FILENAME, 
                  "uint32", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(FC_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) {
    uint32 val;

    val = (n_bits_func(i) >= 5) ? i : 0;
    MakeTable_outputUInt32(val);
  };

  MakeTable_end();
}
Esempio n. 9
0
static void 
doStraightValueTable(void) {
  int i;

  MakeTable_begin("evxStrValueTable", 
                  SV_FILENAME, 
                  "uint32", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(SV_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) {
    uint32 sv, val;

    sv = straight_func(i);
    val = sv ? 
      (1 << sv) | EvxHandVal_STRAIGHT : 0;
    MakeTable_outputUInt32(val);
  };

  MakeTable_end();
}
Esempio n. 10
0
static void 
doTopTwoBitsTable(void) {
  int i;

  MakeTable_begin("topTwoBitsTable", 
                  T2B_FILENAME, 
                  "uint32", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(T2B_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) {
    uint32 retval, n;

    n = i;
    retval = top_bit_func(n);
    n ^= retval;
    retval |= top_bit_func(n);
    MakeTable_outputUInt32(retval);
  };

  MakeTable_end();
}
Esempio n. 11
0
static void 
doNBitsAndStrTable(void) {
  int i;
  uint8 val, t;

  MakeTable_begin("nBitsAndStrTable", 
                  NBS_FILENAME, 
                  "uint8", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(NBS_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) {
    val = n_bits_func(i);
    assert((val & 0xF0) == 0);
    t = straight_func(i);

    MakeTable_outputUInt8((val << 2) 
                          | (((t != 0) & 0x01) << 1) 
                          | ((val >= 5) & 0x01) );
  };

  MakeTable_end();
}
Esempio n. 12
0
static void 
doTripsValueTable(void) {
  int i;

  MakeTable_begin("evxTripsValueTable", 
                  TV_FILENAME, 
                  "uint32", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(TV_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) {
    uint32 val, cards;

    cards = i;
    val = top_bit_func(cards);
    cards ^= val;
    val |= top_bit_func(cards);
    if (val)
      val |= EvxHandVal_TRIPS;
    MakeTable_outputUInt32(val);
  };

  MakeTable_end();
}
Esempio n. 13
0
static void 
doCardMaskTable(void) {
  StdDeck_CardMask c;
  int i;

  MakeTable_begin("StdDeck_cardMasksTable", 
                  CM_FILENAME, 
                  "StdDeck_CardMask", 
                  StdDeck_N_CARDS);
  MakeTable_comment(CM_COMMENT_STRING);
  for (i=0; i<StdDeck_N_CARDS; i++) {
    int suit = StdDeck_SUIT(i);
    int rank = StdDeck_RANK(i);

    StdDeck_CardMask_RESET(c);
    if (suit == StdDeck_Suit_HEARTS)
      c.cards.hearts = (1 << rank);
    else if (suit == StdDeck_Suit_DIAMONDS)
      c.cards.diamonds = (1 << rank);
    else if (suit == StdDeck_Suit_CLUBS)
      c.cards.clubs = (1 << rank);
    else if (suit == StdDeck_Suit_SPADES)
      c.cards.spades = (1 << rank);

#ifdef HAVE_INT64
    MakeTable_outputUInt64(c.cards_n);
#else
    {
      char buf[80];
      sprintf(buf, " { { 0x%08x, 0x%08x } } ", c.cards_nn.n1, c.cards_nn.n2);
      MakeTable_outputString(buf);
    };
#endif
  };

  MakeTable_end();
}
Esempio n. 14
0
static void 
doTopFiveBitsTable(void) {
  int i;

  MakeTable_begin("topFiveBitsTable", 
                  T5B_FILENAME, 
                  "uint32", 
                  StdDeck_N_RANKMASKS);
  MakeTable_comment(T5B_COMMENT_STRING);
  for (i=0; i < StdDeck_N_RANKMASKS; i++) {
    uint32 retval, temp, n;

    n = i;
    temp = top_bit_func( n );  retval  = temp;  n &= ~temp;
    temp = top_bit_func( n );  retval |= temp;  n &= ~temp;
    temp = top_bit_func( n );  retval |= temp;  n &= ~temp;
    temp = top_bit_func( n );  retval |= temp;  n &= ~temp;
    temp = top_bit_func( n );  retval |= temp;

    MakeTable_outputUInt32(retval);
  };

  MakeTable_end();
}