void CSymbolEngineLists::CalculateLists() { unsigned int card0, card1; if (StdDeck_RANK(p_scraper->card_player(USER_CHAIR, 0)) >= StdDeck_RANK(p_scraper->card_player(USER_CHAIR, 1))) { card0 = p_scraper->card_player(USER_CHAIR, 0); card1 = p_scraper->card_player(USER_CHAIR, 1); } else { card0 = p_scraper->card_player(USER_CHAIR, 1); card1 = p_scraper->card_player(USER_CHAIR, 0); } int number_of_lists = p_formula->formula()->mHandList.GetSize(); for (int i=0; i<number_of_lists; i++) { int listnum = atoi(p_formula->formula()->mHandList[i].list.Mid(4).GetString()); if ((StdDeck_SUIT(card0)==StdDeck_SUIT(card1) && p_formula->formula()->inlist[listnum][StdDeck_RANK(card0)][StdDeck_RANK(card1)]) || (StdDeck_SUIT(card0)!=StdDeck_SUIT(card1) && p_formula->formula()->inlist[listnum][StdDeck_RANK(card1)][StdDeck_RANK(card0)])) { SetIsList(listnum, true); // islistxx } else { SetIsList(listnum, false); } } }
void CSymbolEngineHandrank::GetCardstring(char *c, unsigned int c0, unsigned int c1) { char card0[10] = {0}, card1[10] = {0}; // figure out the card string to search for if (StdDeck_RANK(c0) >= StdDeck_RANK(c1)) { StdDeck_cardToString(c0, card0); StdDeck_cardToString(c1, card1); } else { StdDeck_cardToString(c1, card0); StdDeck_cardToString(c0, card1); } c[0] = card0[0]; c[1] = card1[0]; if (c[0] == c[1] || card0[1] != card1[1]) { c[2] = 'o'; } else { c[2] = 's'; } c[3]='\0'; }
int StdDeck_cardToString(int cardIndex, char *outString) { *outString++ = StdDeck_rankChars[StdDeck_RANK(cardIndex)]; *outString++ = StdDeck_suitChars[StdDeck_SUIT(cardIndex)]; *outString = '\0'; return 2; }
void CRank169To1326Utility::Generate169(const int c1, const int c2, char* buffer) { const char* rankChars = "23456789TJQKA"; memset(buffer, '\0', 4); int rank_card1 = StdDeck_RANK(c1); int suit_card1 = StdDeck_SUIT(c1); int rank_card2 = StdDeck_RANK(c2); int suit_card2 = StdDeck_SUIT(c2); char str_rank1 = rankChars[rank_card1]; char str_rank2 = rankChars[rank_card2]; char suited = ((suit_card1 == suit_card2) ? 's' : 'o'); if(rank_card1 > rank_card2) sprintf_s(buffer, 4, "%c%c%c", str_rank1, str_rank2, suited); else sprintf_s(buffer, 4, "%c%c%c", str_rank2, str_rank1, suited); }
// Convert our member variable card (poker-eval format) to our own Card class Card Hand::ConvertPokerEvalCardToCard(int card) const { int rank, suit; // We must convert the poker-eval format (16-bit) // (rank*4)+suit // // to our hand from our format (8-bit): // | 7 6 5 4 3 2 1 0 | // | rank | suit | // rank = StdDeck_RANK(card)+2; suit = StdDeck_SUIT(card) == StdDeck_Suit_CLUBS ? Card::CLUBS : StdDeck_SUIT(card) == StdDeck_Suit_DIAMONDS ? Card::DIAMONDS : StdDeck_SUIT(card) == StdDeck_Suit_HEARTS ? Card::HEARTS : StdDeck_SUIT(card) == StdDeck_Suit_SPADES ? Card::SPADES : 0; return (Card(rank, suit)); }
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(); }
void CGameState::CaptureState() { bool playing = true; unsigned char card = CARD_NOCARD; // figure out if I am playing int sym_chair = p_symbol_engine_userchair->userchair(); if (!p_symbol_engine_userchair->userchair_confirmed()) { playing = false; } else if (p_scraper->card_player(sym_chair, 0) == CARD_BACK || p_scraper->card_player(sym_chair, 1) == CARD_BACK || p_scraper->card_player(sym_chair, 0) == CARD_NOCARD || p_scraper->card_player(sym_chair, 1) == CARD_NOCARD) { playing = false; } // Poker window title char title[MAX_WINDOW_TITLE]; GetWindowText(p_autoconnector->attached_hwnd(), title, MAX_WINDOW_TITLE); strncpy_s(_state[_state_index&0xff].m_title, 64, title, _TRUNCATE); _state[_state_index&0xff].m_title[63] = '\0'; // Pot information for (int i=0; i<k_max_number_of_players; i++) _state[_state_index&0xff].m_pot[i] = p_scraper->pot(i); // Common cards for (int i=0; i<k_number_of_community_cards; i++) { if (p_scraper->card_common(i) == CARD_BACK) { card = WH_CARDBACK; } else if (p_scraper->card_common(i) == CARD_NOCARD) { card = WH_NOCARD; } else { card = ((StdDeck_RANK(p_scraper->card_common(i))+2)<<4) | (StdDeck_SUIT(p_scraper->card_common(i)) == StdDeck_Suit_CLUBS ? WH_SUIT_CLUBS : StdDeck_SUIT(p_scraper->card_common(i)) == StdDeck_Suit_DIAMONDS ? WH_SUIT_DIAMONDS : StdDeck_SUIT(p_scraper->card_common(i)) == StdDeck_Suit_HEARTS ? WH_SUIT_HEARTS : StdDeck_SUIT(p_scraper->card_common(i)) == StdDeck_Suit_SPADES ? WH_SUIT_SPADES : 0) ; } _state[_state_index&0xff].m_cards[i] = card; } // playing, posting, dealerchair int sym_dealerchair = p_symbol_engine_dealerchair->dealerchair(); bool sym_isautopost = p_symbol_engine_autoplayer->isautopost(); _state[_state_index&0xff].m_is_playing = playing; _state[_state_index&0xff].m_is_posting = sym_isautopost; _state[_state_index&0xff].m_fillerbits = 0; _state[_state_index&0xff].m_fillerbyte = 0; _state[_state_index&0xff].m_dealer_chair = sym_dealerchair; // loop through all 10 player chairs for (int i=0; i<k_max_number_of_players; i++) { // player name, balance, currentbet strncpy_s(_state[_state_index&0xff].m_player[i].m_name, 16, p_scraper->player_name(i).GetString(), _TRUNCATE); _state[_state_index&0xff].m_player[i].m_balance = p_symbol_engine_chip_amounts->balance(i); _state[_state_index&0xff].m_player[i].m_currentbet = p_symbol_engine_chip_amounts->currentbet(i); // player cards for (int j=0; j<k_number_of_cards_per_player; j++) { if (p_scraper->card_player(i, j) == CARD_BACK) { card = WH_CARDBACK; } else if (p_scraper->card_player(i, j) == CARD_NOCARD) { card = WH_NOCARD; } else { card = ((StdDeck_RANK(p_scraper->card_player(i, j))+2)<<4) | (StdDeck_SUIT(p_scraper->card_player(i, j)) == StdDeck_Suit_CLUBS ? WH_SUIT_CLUBS : StdDeck_SUIT(p_scraper->card_player(i, j)) == StdDeck_Suit_DIAMONDS ? WH_SUIT_DIAMONDS : StdDeck_SUIT(p_scraper->card_player(i, j)) == StdDeck_Suit_HEARTS ? WH_SUIT_HEARTS : StdDeck_SUIT(p_scraper->card_player(i, j)) == StdDeck_Suit_SPADES ? WH_SUIT_SPADES : 0) ; } _state[_state_index&0xff].m_player[i].m_cards[j] = card; } // player name known, balance known _state[_state_index&0xff].m_player[i].m_name_known = p_scraper->name_good_scrape(i) ? 1 : 0; _state[_state_index&0xff].m_player[i].m_balance_known = p_scraper->balance_good_scrape(i) ? 1 : 0; _state[_state_index&0xff].m_player[i].m_fillerbits = 0; _state[_state_index&0xff].m_player[i].m_fillerbyte = 0; } _state_index++; }
bool CVersus::GetCounts(void) { if (_versus_fh == k_undefined) return false; int i = 0, j = 0; CardMask plCards, oppCards, deadCards, comCardsScrape, comCardsEnum, comCardsAll, usedCards; unsigned int wintemp = 0, tietemp = 0, lostemp = 0, offset = 0; unsigned int nhiwin = 0, nhitie = 0, nhilos = 0, ntiwin = 0, ntitie = 0, ntilos = 0, nlowin = 0, nlotie = 0, nlolos = 0; unsigned int nhinowwin = 0, nhinowtie = 0, nhinowlos = 0, ntinowwin = 0, ntinowtie = 0, ntinowlos = 0, nlonowwin = 0, nlonowtie = 0, nlonowlos = 0; unsigned int c0rank = 0, c1rank = 0, temprank = 0; BYTE byte[8] = {0}; long pos = 0; int listnum = 0; int card0_offset[52] = { 0, 62475, 123725, 183750, 242550, 300125, 356475, 411600, 465500, 518175, 569625, 619850, 668850, 716625, 763175, 808500, 852600, 895475, 937125, 977550, 1016750, 1054725, 1091475, 1127000, 1161300, 1194375, 1226225, 1256850, 1286250, 1314425, 1341375, 1367100, 1391600, 1414875, 1436925, 1457750, 1477350, 1495725, 1512875, 1528800, 1543500, 1556975, 1569225, 1580250, 1590050, 1598625, 1605975, 1612100, 1617000, 1620675, 1623125, 1624350 }; int betround = p_betround_calculator->betround(); int sym_userchair = (int) p_symbol_engine_userchair->userchair(); unsigned int pcard[2] = {0}; for (i=0; i<=1; i++) pcard[i] = CARD_NOCARD; unsigned int card_player[2] = {0}, card_common[5] = {0}; for (i=0; i<=1; i++) card_player[i] = p_scraper->card_player(sym_userchair, i); for (i=0; i<=4; i++) card_common[i] = p_scraper->card_common(i); // Get the lock CSLock lock(m_critsec); if (!p_symbol_engine_userchair->userchair_confirmed()) return false; if (card_player[0] == CARD_NOCARD || card_player[0] == CARD_BACK || card_player[1] == CARD_NOCARD || card_player[1] == CARD_BACK) { return false; } _nwin = _ntie = _nlos = _nhands = 0; _nhandshi = _nhandsti = _nhandslo = 0; _nhandshinow = _nhandstinow = _nhandslonow = 0; _vsprwinhi = _vsprtiehi = _vsprloshi = 0; _vsprwinti = _vsprtieti = _vsprlosti = 0; _vsprwinlo = _vsprtielo = _vsprloslo = 0; _vsprwinhinow = _vsprtiehinow = _vsprloshinow = 0; _vsprwintinow = _vsprtietinow = _vsprlostinow = 0; _vsprwinlonow = _vsprtielonow = _vsprloslonow = 0; nhiwin = nhitie = nhilos = ntiwin = ntitie = ntilos = nlowin = nlotie = nlolos = 0; // Clear counters for (listnum=0; listnum<MAX_HAND_LISTS; listnum++) _nlistwin[listnum] = _nlisttie[listnum] = _nlistlos[listnum] = 0; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // PREFLOP if (betround == k_betround_preflop) { // order cards properly if (card_player[0] < card_player[1]) { pcard[0] = card_player[0]; pcard[1] = card_player[1]; } else { pcard[0] = card_player[1]; pcard[1] = card_player[0]; } // figure out offset into file offset = 0; //for (i=1; i<pcard[0]; i++) offset += (52-i)*1225; offset += card0_offset[pcard[0]]; offset += (pcard[1]-pcard[0]-1)*1225; offset *= sizeof(byte); // seek to right position in file if ((pos = _lseek(_versus_fh, offset, SEEK_SET)) == long(k_undefined)) { return false; } wintemp = lostemp = 0; for (i=0; i<(k_number_of_cards_per_deck - 1); i++) { for (j=i+1; j<k_number_of_cards_per_deck; j++) { if (i!=pcard[0] && i!=pcard[1] && j!=pcard[0] && j!=pcard[1]) { _read(_versus_fh, &byte, sizeof(byte)); memcpy(&wintemp, &byte[0], sizeof(unsigned int)); memcpy(&lostemp, &byte[4], sizeof(unsigned int)); _nwin += wintemp; _ntie += 1712304 - wintemp - lostemp; _nlos += lostemp; _nhands = _nhands + 1; if (wintemp<lostemp) { _nhandshi = _nhandshi + 1; nhiwin += wintemp; nhitie += 1712304 - wintemp - lostemp; nhilos += lostemp; } else if (wintemp>lostemp) { _nhandslo = _nhandslo + 1; nlowin += wintemp; nlotie += 1712304 - wintemp - lostemp; nlolos += lostemp; } else { _nhandsti = _nhandsti + 1; ntiwin += wintemp; ntitie += 1712304 - wintemp - lostemp; ntilos += lostemp; } // Calculations for vs$xx$prwin, vs$xx$prtie, vs$xx$prlos c0rank = StdDeck_RANK(i); c1rank = StdDeck_RANK(j); if (c0rank < c1rank) { temprank = c0rank; c0rank = c1rank; c1rank = temprank; } for (listnum=0; listnum<MAX_HAND_LISTS; listnum++) { if ((StdDeck_SUIT(i)==StdDeck_SUIT(j) && p_formula->formula()->inlist[listnum][c0rank][c1rank]) || (StdDeck_SUIT(i)!=StdDeck_SUIT(j) && p_formula->formula()->inlist[listnum][c1rank][c0rank])) { _nlistwin[listnum] += wintemp; _nlisttie[listnum] += 1712304 - wintemp - lostemp; _nlistlos[listnum] += lostemp; } } } } } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // FLOP, TURN, RIVER else if (betround >= k_betround_flop) { CardMask playerEvalCardsNow, oppEvalCardsNow; HandVal player_hv_now = 0, opp_hv_now = 0; // Common cards CardMask_RESET(comCardsScrape); if (betround >= k_betround_flop) CardMask_SET(comCardsScrape, card_common[0]); if (betround >= k_betround_flop) CardMask_SET(comCardsScrape, card_common[1]); if (betround >= k_betround_flop) CardMask_SET(comCardsScrape, card_common[2]); if (betround >= k_betround_turn) CardMask_SET(comCardsScrape, card_common[3]); if (betround >= k_betround_river) CardMask_SET(comCardsScrape, card_common[4]); // player cards CardMask_RESET(plCards); CardMask_SET(plCards, card_player[0]); CardMask_SET(plCards, card_player[1]); // all used cards CardMask_OR(usedCards, comCardsScrape, plCards); // eval player hand now CardMask_OR(playerEvalCardsNow, plCards, comCardsScrape); player_hv_now = Hand_EVAL_N(playerEvalCardsNow, betround+3); // Enumerate through all possible opponent hands (excludes already used cards) for (i=0; i<=50; i++) { for (j=i+1; j<=51; j++) { if (!CardMask_CARD_IS_SET(usedCards, i) && !CardMask_CARD_IS_SET(usedCards, j)) { CardMask_RESET(oppCards); CardMask_SET(oppCards, i); CardMask_SET(oppCards, j); // Enumerate through all possible river situations (exclude player cards and opponent cards) CardMask_OR(deadCards, usedCards, oppCards); wintemp = tietemp = lostemp = 0; if (betround==k_betround_flop || betround==k_betround_turn) { ENUMERATE_N_CARDS_D(comCardsEnum, betround==k_betround_flop ? 2 : betround==k_betround_turn ? 1 : 0, deadCards, { CardMask_OR(comCardsAll, comCardsScrape, comCardsEnum); DoCalc(plCards, oppCards, comCardsAll, &wintemp, &tietemp, &lostemp); }); }
void COpenHoldemView::DrawCard(const unsigned int card, const int left, const int top, const int right, const int bottom, const bool pl_card) { CPen *pTempPen = NULL, oldpen; CBrush *pTempBrush = NULL, oldbrush; RECT rrect = {0}, srect = {0}; CFont *oldfont = NULL, cFont; CDC *pDC = GetDC(); // Set font basics _logfont.lfHeight = -24; _logfont.lfWeight = FW_BOLD; cFont.CreateFontIndirect(&_logfont); oldfont = pDC->SelectObject(&cFont); // Background color pDC->SetBkColor(COLOR_GRAY); // CARD BACK if (card == CARD_BACK) { pTempPen = (CPen*)pDC->SelectObject(&_black_pen); oldpen.FromHandle((HPEN)pTempPen); // Save old pen pTempBrush = (CBrush*)pDC->SelectObject(&_yellow_brush); oldbrush.FromHandle((HBRUSH)pTempBrush); // Save old brush pDC->SetBkMode(OPAQUE); pDC->RoundRect(left, top, right, bottom, 5, 5); // Restore original pen and brush pDC->SelectObject(oldpen); pDC->SelectObject(oldbrush); } // NO CARD else if (card == CARD_NOCARD) { pTempPen = (CPen*)pDC->SelectObject(&_white_dot_pen); oldpen.FromHandle((HPEN)pTempPen); // Save old pen pTempBrush = (CBrush*)pDC->SelectObject(&_gray_brush); oldbrush.FromHandle((HBRUSH)pTempBrush); // Save old brush pDC->SetBkMode(OPAQUE); pDC->RoundRect(left, top, right, bottom, 5, 5); // Restore original pen and brush pDC->SelectObject(oldpen); pDC->SelectObject(oldbrush); } // NORMAL CARD else { // Rect for rank and suit location rrect.left = left; rrect.top = top; rrect.right = right; rrect.bottom = top + ((bottom-top)/2); srect.left = left; srect.top = top + ((bottom-top)/2) + 1 - (pl_card ? 7 : 0); srect.right = right; srect.bottom = bottom - (pl_card ? 7 : 0); // Draw card rect and suit pTempBrush = (CBrush*)pDC->SelectObject(&_white_brush); oldbrush.FromHandle((HBRUSH)pTempBrush); // Save old brush // Set colors switch (StdDeck_SUIT(card)) { case Suit_CLUBS: pDC->SetTextColor(COLOR_GREEN); pTempPen = (CPen*)pDC->SelectObject(&_green_pen); break; case Suit_DIAMONDS: pDC->SetTextColor(COLOR_BLUE); pTempPen = (CPen*)pDC->SelectObject(&_blue_pen); break; case Suit_HEARTS: pDC->SetTextColor(COLOR_RED); pTempPen = (CPen*)pDC->SelectObject(&_red_pen); break; case Suit_SPADES: pDC->SetTextColor(COLOR_BLACK); pTempPen = (CPen*)pDC->SelectObject(&_black_pen); break; default: pTempPen = (CPen*)pDC->GetCurrentPen(); break; } oldpen.FromHandle((HPEN)pTempPen); // Save old pen // Draw card and suit pDC->SetBkMode(OPAQUE); pDC->RoundRect(left, top, right, bottom, 5, 5); pDC->SetBkMode(TRANSPARENT); switch (StdDeck_SUIT(card)) { case Suit_CLUBS: pDC->DrawText("C", -1, &srect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Suit_DIAMONDS: pDC->DrawText("D", -1, &srect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Suit_HEARTS: pDC->DrawText("H", -1, &srect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Suit_SPADES: pDC->DrawText("S", -1, &srect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; } // Draw card rank switch (StdDeck_RANK(card)) { case Rank_2: pDC->DrawText("2", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_3: pDC->DrawText("3", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_4: pDC->DrawText("4", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_5: pDC->DrawText("5", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_6: pDC->DrawText("6", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_7: pDC->DrawText("7", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_8: pDC->DrawText("8", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_9: pDC->DrawText("9", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_TEN: pDC->DrawText("T", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_JACK: pDC->DrawText("J", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_QUEEN: pDC->DrawText("Q", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_KING: pDC->DrawText("K", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; case Rank_ACE: pDC->DrawText("A", -1, &rrect, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); break; } // Restore original pen and brush pDC->SelectObject(oldpen); pDC->SelectObject(oldbrush); } pDC->SelectObject(oldfont); cFont.DeleteObject(); ReleaseDC(pDC); }
unsigned int wrap_StdDeck_RANK(unsigned int index) { return StdDeck_RANK(index); }
card == CARD_NOCARD ? " " : StdDeck_SUIT(card) == Suit_CLUBS ? "♣" : StdDeck_SUIT(card) == Suit_DIAMONDS ? "♦" : StdDeck_SUIT(card) == Suit_HEARTS ? "♥" : StdDeck_SUIT(card) == Suit_SPADES ? "♠" : " "; color = card == CARD_BACK ? "black" : card == CARD_NOCARD ? "black" : StdDeck_SUIT(card) == Suit_CLUBS ? "green" : StdDeck_SUIT(card) == Suit_DIAMONDS ? "blue" : StdDeck_SUIT(card) == Suit_HEARTS ? "red" : StdDeck_SUIT(card) == Suit_SPADES ? "black" : "black"; rank = card == CARD_BACK ? "*" : card == CARD_NOCARD ? " " : StdDeck_RANK(card) == Rank_ACE ? "A" : StdDeck_RANK(card) == Rank_KING ? "K" : StdDeck_RANK(card) == Rank_QUEEN ? "Q" : StdDeck_RANK(card) == Rank_JACK ? "J" : StdDeck_RANK(card) == Rank_TEN ? "T" : StdDeck_RANK(card) == Rank_9 ? "9" : StdDeck_RANK(card) == Rank_8 ? "8" : StdDeck_RANK(card) == Rank_7 ? "7" : StdDeck_RANK(card) == Rank_6 ? "6" : StdDeck_RANK(card) == Rank_5 ? "5" : StdDeck_RANK(card) == Rank_4 ? "4" : StdDeck_RANK(card) == Rank_3 ? "3" : StdDeck_RANK(card) == Rank_2 ? "2" : " "; final.Format("<font color=%s>%s%s</font>", color, rank, suit); return final;
void write_logautoplay(int level, const char * action) { char nowtime[26]; CString pcards, comcards, temp, rank, pokerhand, bestaction, fcra_seen; char *card; CardMask Cards; int i, nCards; HandVal hv; CString fcra_formula_status; int sym_userchair = (int) p_symbols->sym()->userchair; int sym_br = (int) p_symbols->sym()->br; if (level>prefs.log_level()) return; if (log_fp != NULL) { CSLock lock(log_critsec); // log$ writing if (prefs.log_symbol_enabled()) { int max_log = p_symbols->logsymbols_collection()->GetCount(); if (max_log > 0) { if (max_log > prefs.log_symbol_max_log()) { max_log = prefs.log_symbol_max_log(); } write_log(1, "*** log$ (Total: %d | Showing: %d)\n", p_symbols->logsymbols_collection()->GetCount(), max_log); for (int i=0; i<max_log; i++) { write_log(1, "*** %s\n", p_symbols->logsymbols_collection()->GetAt(i)); } } } CardMask_RESET(Cards); nCards=0; // player cards if (p_symbols->user_chair_confirmed()) { for (i=0; i<=1; i++) { card = StdDeck_cardString(p_scraper->card_player(sym_userchair, i)); temp.Format("%s", card); pcards.Append(temp); CardMask_SET(Cards, p_scraper->card_player(sym_userchair, i)); nCards++; } } else { pcards = "...."; } // common cards comcards = ""; if (sym_br >= 2) { for (i=0; i<=2; i++) { if (p_scraper->card_common(i) != CARD_BACK && p_scraper->card_common(i) != CARD_NOCARD) { card = StdDeck_cardString(p_scraper->card_common(i)); temp.Format("%s", card); comcards.Append(temp); CardMask_SET(Cards, p_scraper->card_common(i)); nCards++; } } } if (sym_br >= 3) { card = StdDeck_cardString(p_scraper->card_common(3)); temp.Format("%s", card); comcards.Append(temp); CardMask_SET(Cards, p_scraper->card_common(3)); nCards++; } if (sym_br >= 4) { card = StdDeck_cardString(p_scraper->card_common(4)); temp.Format("%s", card); comcards.Append(temp); CardMask_SET(Cards, p_scraper->card_common(4)); nCards++; } comcards.Append(".........."); comcards = comcards.Left(10); // handrank if (prefs.sym_handrank_value() == "169") rank.Format("%.0f", p_symbols->sym()->handrank169); else if (prefs.sym_handrank_value() == "1000") rank.Format("%.0f", p_symbols->sym()->handrank1000); else if (prefs.sym_handrank_value() == "1326") rank.Format("%.0f", p_symbols->sym()->handrank1326); else if (prefs.sym_handrank_value() == "2652") rank.Format("%.0f", p_symbols->sym()->handrank2652); else if (prefs.sym_handrank_value() == "p") rank.Format("%.2f", p_symbols->sym()->handrankp); // poker hand hv = Hand_EVAL_N(Cards, nCards); if (HandVal_HANDTYPE(hv)==HandType_STFLUSH && StdDeck_RANK(HandVal_TOP_CARD(hv))==Rank_ACE) pokerhand="royfl"; else if (HandVal_HANDTYPE(hv)==HandType_STFLUSH) pokerhand="strfl"; else if (HandVal_HANDTYPE(hv)==HandType_QUADS) pokerhand="4kind"; else if (HandVal_HANDTYPE(hv)==HandType_FULLHOUSE) pokerhand="fullh"; else if (HandVal_HANDTYPE(hv)==HandType_FLUSH) pokerhand="flush"; else if (HandVal_HANDTYPE(hv)==HandType_STRAIGHT) pokerhand="strai"; else if (HandVal_HANDTYPE(hv)==HandType_TRIPS) pokerhand="3kind"; else if (HandVal_HANDTYPE(hv)==HandType_TWOPAIR) pokerhand="2pair"; else if (HandVal_HANDTYPE(hv)==HandType_ONEPAIR) pokerhand="1pair"; else if (HandVal_HANDTYPE(hv)==HandType_NOPAIR) pokerhand="hcard"; // best action if (strcmp(action, "SWAG")==0) { bestaction.Format("$%.2f", p_symbols->f$betsize()); } else { if (p_symbols->f$alli()) bestaction = "Allin"; else if (p_symbols->f$betsize()) bestaction = "SWAG"; else if (p_symbols->f$rais()) bestaction = "Bet/Raise"; else if (p_symbols->f$call()) bestaction = "Call/Check"; else if (p_symbols->f$prefold()) bestaction = "Pre-fold"; else bestaction = "Fold/Check"; } // fcra_seen int sym_myturnbits = (int) p_symbols->sym()->myturnbits; fcra_seen.Format("%s%s%s%s%s", sym_myturnbits&0x01 ? "F" : ".", sym_myturnbits&0x02 ? "C" : ".", // Check button out of order to stay consistent // with button order in manual mode. sym_myturnbits&0x10 ? "K" : ".", sym_myturnbits&0x04 ? "R" : ".", sym_myturnbits&0x08 ? "A" : "."); // fcra formula status fcra_formula_status.Format("%s%s%s%s", !p_symbols->f$alli() && !p_symbols->f$rais() && !p_symbols->f$call() && !p_symbols->f$betsize() ? "F" : ".", p_symbols->f$call() ? "C" : ".", p_symbols->f$rais() ? "R" : ".", p_symbols->f$alli() ? "A" : "."); fprintf(log_fp, "%s - %1d ", get_time(nowtime), p_tablemap->nchairs()); fprintf(log_fp, "%4s %10s %4s %5s ", pcards.GetString(), comcards.GetString(), rank.GetString(), pokerhand.GetString()); fprintf(log_fp, "%4d %4d %4d ", (int) (p_symbols->sym()->prwin*1000), (int) (p_symbols->sym()->prlos*1000), (int) (p_symbols->sym()->prtie*1000)); fprintf(log_fp, "%2d %8d %-10s - ", (int) p_symbols->sym()->nopponents, (int) p_symbols->sym()->nit, bestaction.GetString()); fprintf(log_fp, "%-5s %9.2f %9.2f %9.2f ", action, p_symbols->sym()->call, p_tablelimits->bet(), p_symbols->sym()->pot); fprintf(log_fp, "%9.2f - %s %s %.2f\n", p_symbols->sym()->balance[10], fcra_seen.GetString(), fcra_formula_status.GetString(), p_symbols->f$betsize() ); if (prefs.trace_enabled() && p_symbols->symboltrace_collection()->GetSize() > 0) { write_log_nostamp(1, "***** Autoplayer Trace ****\n"); for (int i=0; i<p_symbols->symboltrace_collection()->GetSize(); i++) { write_log_nostamp(1, "%s\n", p_symbols->symboltrace_collection()->GetAt(i)); } write_log_nostamp(1, "***********************\n"); } fflush(log_fp); } }
void CRank169To1326Utility::FillRanges(const int hc1, const int hc2, const int index1326) { // CONTAINS RANKS // hasAces, hasKings, hasQueens, hasTens, hasNines, hasEights, hasSevens, hasSixes, hasFives, hasFours, hasThrees, hasTwos; // Aces if(StdDeck_RANK(hc1) == 12 || StdDeck_RANK(hc2) == 12) hasAces.insert(index1326); // Kings if(StdDeck_RANK(hc1) == 11 || StdDeck_RANK(hc2) == 11) hasKings.insert(index1326); // Queens if(StdDeck_RANK(hc1) == 10 || StdDeck_RANK(hc2) == 10) hasQueens.insert(index1326); // Jacks if(StdDeck_RANK(hc1) == 9 || StdDeck_RANK(hc2) == 9) hasJacks.insert(index1326); // Tens if(StdDeck_RANK(hc1) == 8 || StdDeck_RANK(hc2) == 8) hasTens.insert(index1326); // Nines if(StdDeck_RANK(hc1) == 7 || StdDeck_RANK(hc2) == 7) hasNines.insert(index1326); // Eights if(StdDeck_RANK(hc1) == 6 || StdDeck_RANK(hc2) == 6) hasEights.insert(index1326); // Sevens if(StdDeck_RANK(hc1) == 5 || StdDeck_RANK(hc2) == 5) hasSevens.insert(index1326); // Sixes if(StdDeck_RANK(hc1) == 4 || StdDeck_RANK(hc2) == 4) hasSixes.insert(index1326); // Fives if(StdDeck_RANK(hc1) == 3 || StdDeck_RANK(hc2) == 3) hasFives.insert(index1326); // Fours if(StdDeck_RANK(hc1) == 2 || StdDeck_RANK(hc2) == 2) hasFours.insert(index1326); // Threes if(StdDeck_RANK(hc1) == 1 || StdDeck_RANK(hc2) == 1) hasThrees.insert(index1326); // Twos if(StdDeck_RANK(hc1) == 0 || StdDeck_RANK(hc2) == 0) hasTwos.insert(index1326); // SUITS // hasHearts, hasDiamonds, hasClubs, hasSpades // hearts if(StdDeck_SUIT(hc1) == 0 || StdDeck_SUIT(hc2) == 0) hasHearts.insert(index1326); // diamonds if(StdDeck_SUIT(hc1) == 1|| StdDeck_SUIT(hc2) == 1) hasDiamonds.insert(index1326); // clubs if(StdDeck_SUIT(hc1) == 2 || StdDeck_SUIT(hc2) == 2) hasClubs.insert(index1326); // spades if(StdDeck_SUIT(hc1) == 3 || StdDeck_SUIT(hc2) == 3) hasSpades.insert(index1326); // PAIRS // pairAcesKings, pairQueensJacks, pairTensToSevens, pairLow; if(StdDeck_RANK(hc1) == StdDeck_RANK(hc2)) { // Aces + Kings if(StdDeck_RANK(hc1) == 12 || StdDeck_RANK(hc1) == 11) pairAcesKings.insert(index1326); // Jacks + Queens else if(StdDeck_RANK(hc1) == 10 || StdDeck_RANK(hc1) == 9) pairQueensJacks.insert(index1326); // Sevens to Tens else if(StdDeck_RANK(hc1) >= 5 || StdDeck_RANK(hc1) <= 8) pairTensToSevens.insert(index1326); // Low Pairs else pairLow.insert(index1326); } // SUITED else if(StdDeck_SUIT(hc1) == StdDeck_SUIT(hc2)) { int suited_max = -1, suited_min = -1; if(StdDeck_RANK(hc1) > StdDeck_RANK(hc2)) { suited_max = StdDeck_RANK(hc1); suited_min = StdDeck_RANK(hc2); } else { suited_max = StdDeck_RANK(hc2); suited_min = StdDeck_RANK(hc1); } // SUITED ACE // suitedAceBig, suitedAceGood, suitedAce2To9; if(suited_max == 12) { // Suited Ace Big if(suited_min == 11) suitedAceBig.insert(index1326); // Suited Ace Good else if(suited_min >= 8) suitedAceGood.insert(index1326); // Suited Ace + 2to9 else suitedAce2To9.insert(index1326); } // SUITED CONNECTORS // suitedConnectorHigh, suitedConnectorMed, suitedConnectorLow; if(suited_max - suited_min == 1) { // Suited Connector High if(suited_max >= 9) suitedConnectorHigh.insert(index1326); // Suited Connector Med else if(suited_max >= 6) suitedConnectorMed.insert(index1326); // Suited Connector Low else suitedConnectorLow.insert(index1326); } } // OFFSUIT else { int off_max = -1, off_min = -1; if(StdDeck_RANK(hc1) > StdDeck_RANK(hc2)) { off_max = StdDeck_RANK(hc1); off_min = StdDeck_RANK(hc2); } else { off_max = StdDeck_RANK(hc2); off_min = StdDeck_RANK(hc1); } // OFFSUIT CONNECTORS // OffconnectorHigh, OffconnectorMed, OffconnectorLow; if(off_max - off_min == 1) { // Off Connector High if(off_max >= 9) offConnectorHigh.insert(index1326); // Off Connector Med else if(off_max >= 6) offConnectorMed.insert(index1326); // Off Connector Low else offConnectorLow.insert(index1326); } } }