本文整理汇总了C++中Card::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ Card::ToString方法的具体用法?C++ Card::ToString怎么用?C++ Card::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card::ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogBasicInfo
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());
}
示例2: ComputeCurrentStatus
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");
}
}