void CAutoplayerTrace::LogBasicInfo(const char *action_taken) { CString pcards, comcards, temp, rank, pokerhand; CString fcra_formula_status; int userchair = p_symbol_engine_userchair->userchair(); int betround = p_betround_calculator->betround(); // player cards if (p_symbol_engine_userchair->userchair_confirmed()) { for (int i=0; i<=1; i++) { Card card = p_table_state->User()->_hole_cards[i]; pcards.Append(card.ToString()); } } else { pcards = "...."; } // common cards comcards = ""; if (betround >= kBetroundFlop) { for (int i=0; i<kNumberOfFlopCards; i++) { if (p_table_state->_common_cards[i].IsKnownCard()) { comcards.Append(p_table_state->_common_cards[i].ToString()); } } } if (betround >= kBetroundTurn) { comcards.Append(p_table_state->_common_cards[3].ToString()); } if (betround >= kBetroundRiver) { comcards.Append(p_table_state->_common_cards[4].ToString()); } comcards.Append(".........."); comcards = comcards.Left(10); // Always use handrank169 here rank.Format("%.0f", p_symbol_engine_handrank->handrank169()); // poker hand pokerhand = p_symbol_engine_pokerval->HandType(); // fcra_seen CString fcra_seen = p_symbol_engine_autoplayer->GetFCKRAString(); // fcra formula status fcra_formula_status.Format("%s%s%s%s%s", p_function_collection->EvaluateAutoplayerFunction(k_autoplayer_function_fold) ? "F" : ".", p_function_collection->EvaluateAutoplayerFunction(k_autoplayer_function_call) ? "C" : ".", p_function_collection->EvaluateAutoplayerFunction(k_autoplayer_function_check) ? "K" : ".", p_function_collection->EvaluateAutoplayerFunction(k_autoplayer_function_raise) ? "R" : ".", p_function_collection->EvaluateAutoplayerFunction(k_autoplayer_function_allin) ? "A" : "."); // More verbose summary in the log // The old WinHoldem format was a complete mess write_log_separator(true, "Basic Info"); write_log(k_always_log_basic_information, " Version: %s\n", VERSION_TEXT); write_log(k_always_log_basic_information, " Chairs: %5d\n", p_tablemap->nchairs()); write_log(k_always_log_basic_information, " Userchair: %5d\n", userchair); write_log(k_always_log_basic_information, " Holecards: %s\n", pcards.GetString()); write_log(k_always_log_basic_information, " Community: %s\n", comcards.GetString()); write_log(k_always_log_basic_information, " Handrank: %s\n", rank.GetString()); write_log(k_always_log_basic_information, " Hand: %s\n", pokerhand.GetString()); write_log(k_always_log_basic_information, " My balance: %9.2f\n", p_table_state->User()->_balance); write_log(k_always_log_basic_information, " My currentbet: %9.2f\n", p_table_state->User()->_bet); write_log(k_always_log_basic_information, " To call: %9.2f\n", p_symbol_engine_chip_amounts->call()); write_log(k_always_log_basic_information, " Pot: %9.2f\n", p_symbol_engine_chip_amounts->pot()); write_log(k_always_log_basic_information, " Big blind: %9.2f\n", p_symbol_engine_tablelimits->bblind()); write_log(k_always_log_basic_information, " Big bet (FL): %9.2f\n", p_symbol_engine_tablelimits->bigbet()); write_log(k_always_log_basic_information, " f$betsize: %9.2f\n", p_function_collection->EvaluateAutoplayerFunction(k_autoplayer_function_betsize)); write_log(k_always_log_basic_information, " Formulas: %s\n", fcra_formula_status.GetString()); write_log(k_always_log_basic_information, " Buttons: %s\n", fcra_seen.GetString()); write_log(k_always_log_basic_information, " Best action: %s\n", BestAction().GetString()); write_log(k_always_log_basic_information, " Action taken: %s\n", action_taken); write_log_separator(true, ""); // Also show "BestAction" in the statusbar. // This needs to be set exactly once to avoid multiple evaluations // of the autoplayer functions p_openholdem_statusbar->SetLastAction(BestAction()); }
void COpenHoldemStatusbar::ComputeCurrentStatus() { CardMask Cards; CString temp; int userchair = p_symbol_engine_userchair->userchair(); // Player cards CardMask_RESET(Cards); int nCards = 0; _status_plcards = ""; if (p_table_state->User()->HasKnownCards()) { for (int i=0; i<k_number_of_cards_per_player; i++) { // This condition got already checked: "playing" Card card = p_table_state->User()->_hole_cards[i]; // Assertion removeed, because the scraper runs in a different thread. // assert(card.IsKnownCard()); _status_plcards.Append(card.ToString()); CardMask_SET(Cards, card.GetValue()); nCards++; } _status_nopp.Format("%d", p_symbol_engine_prwin->nopponents_for_prwin()); } else { for (int i=0; i<k_number_of_cards_per_player; i++) { if (p_table_state->User()->HasKnownCards()) { Card card = p_table_state->User()->_hole_cards[i]; _status_plcards.Append(card.ToString()); CardMask_SET(Cards, card.GetValue()); nCards++; } } // Not playing, therefore no opponents to be considered for prwin. _status_nopp = ""; } // Common cards _status_comcards = ""; for (int i=0; i<k_number_of_community_cards; i++) { Card card = p_table_state->_common_cards[i]; if (card.IsKnownCard()) { _status_comcards.Append(card.ToString()); CardMask_SET(Cards, card.GetValue()); nCards++; } } // poker hand HandVal hv = Hand_EVAL_N(Cards, nCards); char hvstring[100] = {0}; HandVal_toString(hv, hvstring); _status_pokerhand = hvstring; _status_pokerhand = _status_pokerhand.Mid(0, _status_pokerhand.Find(" ")); // Always use handrank169 here _status_handrank.Format("%.0f/169", p_symbol_engine_handrank->handrank169()); // Always update prwin/nit if (p_symbol_engine_userchair->userchair_confirmed() && p_table_state->User()->HasKnownCards()) { _status_prwin.Format("%d/%d/%d", (int) (p_iterator_thread->prwin()*1000), (int) (p_iterator_thread->prtie()*1000), (int) (p_iterator_thread->prlos()*1000)); double iterations; p_engine_container->EvaluateSymbol("f$prwin_number_of_iterations", &iterations); _status_nit.Format("%d/%s", p_iterator_thread->IteratorThreadProgress(), Number2CString(iterations)); } else { _status_prwin = "0/0/0"; // No iteratrions without userchair or cards _status_nit.Format("0"); } }