void CSymbolEngineTableLimits::AutoLockBlindsForCashgamesAfterNHands() {
	if (p_symbol_engine_istournament == NULL)	{
		// Initialization phase
		// Null pointer possible due to circular dependency
		// Simply leave because it is too early to lock the blinds
		return;
	}
	write_log(preferences.debug_table_limits(), 
    "[CSymbolEngineTableLimits] AutoLockBlindsForCashgamesAfterNHands()\n");
	write_log(preferences.debug_table_limits(),
    "[CSymbolEngineTableLimits] blinds_locked_for_complete_session: %s\n", 
    Bool2CString(blinds_locked_for_complete_session));
	write_log(preferences.debug_table_limits(), 
    "[CSymbolEngineTableLimits] istournament: %s\n", 
    Bool2CString(p_symbol_engine_istournament->istournament()));
	if (blinds_locked_for_complete_session) {
    write_log(preferences.debug_table_limits(), 
      "[CSymbolEngineTableLimits] blinds_locked_for_complete_session\n");
		write_log(preferences.debug_table_limits(), 
      "[CSymbolEngineTableLimits] Leaving CSymbolEngineTableLimits::AutoLockBlindsForCashgamesAfterNHands() early\n");
		return;
  }
  if (p_symbol_engine_istournament->istournament())	{
		write_log(preferences.debug_table_limits(), 
      "[CSymbolEngineTableLimits] istournament\n");
		write_log(preferences.debug_table_limits(), 
      "[CSymbolEngineTableLimits] Leaving CSymbolEngineTableLimits::AutoLockBlindsForCashgamesAfterNHands() early\n");
		return;
	}
	if (number_of_saved_tablelimits == k_number_of_hands_to_autolock_blinds_for_cashgames) {
		// We simply take the median as the "correct" value.
		// This works, as long as less than half of the values are too small
		// and less than half of the values are too high.
		// Rasonable assumption, otherwise we have name serious problem anyway.
		tablelimit_locked_for_complete_session.sblind = median(tablelimits_first_N_hands_sblind, k_number_of_hands_to_autolock_blinds_for_cashgames);
		tablelimit_locked_for_complete_session.bblind = median(tablelimits_first_N_hands_bblind, k_number_of_hands_to_autolock_blinds_for_cashgames);
		tablelimit_locked_for_complete_session.bbet   = median(tablelimits_first_N_hands_bbet,   k_number_of_hands_to_autolock_blinds_for_cashgames);
		blinds_locked_for_complete_session = true;
		write_log(preferences.debug_table_limits(), 
      "[CSymbolEngineTableLimits] Locking blinds at %.2f / %.2f / %.2f\n", 
      tablelimit_locked_for_complete_session.sblind, 
			tablelimit_locked_for_complete_session.bblind, 
      tablelimit_locked_for_complete_session.bbet);
	}	else {
		write_log(preferences.debug_table_limits(), 
      "[CSymbolEngineTableLimits] Not yet enough hands to lock blinds permanent.\n");
	}
}
bool CHandresetDetector::IsHandresetByNopponentsplaying() {
  bool ishandreset = (_nopponentsplaying > _last_nopponentsplaying)
    && (_community_cards == 0);
  write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by nopponentsplaying: %s\n",
		Bool2CString(ishandreset));
  return ishandreset;
}
bool CBetroundCalculator::IsNewBetround()
{ 
	bool result = (_betround != _betround_previous_heartbeat);
	 write_log(preferences.debug_alltherest(), "[CBetroundCalculator] IsNewBetround() = %s\n",
		Bool2CString(result));
	return result; 
}
bool CHandresetDetector::IsHandresetByCommunityCards() {
  bool ishandreset = ((_community_cards < _last_community_cards)
    && (_community_cards == 0));
  write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by community cards: %s\n",
		Bool2CString(ishandreset));
  return ishandreset;
}
bool CHandresetDetector::IsHandresetByChangingBlindLevel() {
  bool ishandreset = (_bblind != _last_bblind)
    && (_bblind != 0)
    && (_last_bblind != 0);
  write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by changing blind level: %s\n",
		Bool2CString(ishandreset));
  return ishandreset;
}
bool CHandresetDetector::IsHandresetByNewSmallBlind() {
  bool ishandreset = SmallBlindExists() 
    && !_small_blind_existed_last_hand
    && (_community_cards == 0);
  write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by new small blind: %s\n",
		Bool2CString(ishandreset));
  return ishandreset;
}
bool CPokerTrackerThread::IsConnected()
{
   write_log(preferences.debug_pokertracker(), "[PokerTracker] connected: %s\n",
    Bool2CString(_connected));
   write_log(preferences.debug_pokertracker(), "[PokerTracker]PXStatus = %d (0 = CONNECTION_OK)\n",
    PQstatus(_pgconn));
	return (_connected && PQstatus(_pgconn) == CONNECTION_OK);
}
bool CHandresetDetector::IsHandresetByHandNumber() {
	bool ishandreset = (handnumber != last_handnumber)
    && IsValidHandNumber(handnumber)
    && IsValidHandNumber(last_handnumber);
	write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by handnumber: %s\n",
		Bool2CString(ishandreset));
	return ishandreset;
}
bool CHandresetDetector::IsHandresetByUserCards() {
	bool ishandreset = (p_table_state->User()->HasKnownCards()
		&& (playercards[0] != last_playercards[0]) 
		&& (playercards[1] != last_playercards[1]));
	write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by cards: %s\n",
		Bool2CString(ishandreset));
	return ishandreset;
}
bool CHandresetDetector::IsHandresetByDealerChair() {
	bool ishandreset = (dealerchair != last_dealerchair)
    && IsValidDealerChair(dealerchair)
    && IsValidDealerChair(last_dealerchair);
	write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by dealerchair: %s\n",
		Bool2CString(ishandreset));
	return ishandreset;
}
Beispiel #11
0
bool CHandresetDetector::CalculateIsHandreset()
{
	bool ishandreset = (IsHandresetByDealerChair()
		|| IsHandresetByCards()
		|| IsHandresetByHandNumber());
	write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] IsHandreset() %s\n",
		Bool2CString(ishandreset));
	return ishandreset;
}
bool CHandresetDetector::IsHandresetByPotsize() {
  // Decreasing potsize and potsize is preflop-like and it is preflop
  bool ishandreset = (_potsize < _last_potsize)
    && (_potsize >= 1 * BIG_BLIND)
    && (_potsize <  6 * BIG_BLIND)
    && (_community_cards == 0);
  write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by potsize: %s\n",
		Bool2CString(ishandreset));
  return ishandreset;
}
void CHeartbeatThread::ScrapeEvaluateAct() {
	p_table_positioner->AlwaysKeepPositionIfEnabled();
	// This critical section lets other threads know that the internal state is being updated
	EnterCriticalSection(&pParent->cs_update_in_progress);

	////////////////////////////////////////////////////////////////////////////////////////////
	// Scrape window
  p_table_title->UpdateTitle();
  write_log(Preferences()->debug_heartbeat(), "[HeartBeatThread] Calling DoScrape.\n");
  p_lazyscraper->DoScrape();
  // We must not check if the scrape of the table changed, because:
  //   * some symbol-engines must be evaluated no matter what
  //   * we might need to act (sitout, ...) on empty/non-changing tables
  //   * auto-player needs stable frames too
	p_engine_container->EvaluateAll();
	// Reply-frames no longer here in the heartbeat.
  // we have a "ReplayFrameController for that.
  LeaveCriticalSection(&pParent->cs_update_in_progress);
	p_openholdem_title->UpdateTitle();
	////////////////////////////////////////////////////////////////////////////////////////////
	// Update scraper output dialog if it is present
	if (m_ScraperOutputDlg) {
		m_ScraperOutputDlg->UpdateDisplay();
	}
  
	////////////////////////////////////////////////////////////////////////////////////////////
	// OH-Validator
	write_log(Preferences()->debug_heartbeat(), "[HeartBeatThread] Calling Validator.\n");
  p_validator->Validate();

	////////////////////////////////////////////////////////////////////////////////////////////
	// Autoplayer
	write_log(Preferences()->debug_heartbeat(), "[HeartBeatThread] autoplayer_engaged(): %s\n", 
		Bool2CString(p_autoplayer->autoplayer_engaged()));
	write_log(Preferences()->debug_heartbeat(), "[HeartBeatThread] p_engine_container->symbol_engine_userchair()->userchair()_confirmed(): %s\n", 
		Bool2CString(p_engine_container->symbol_engine_userchair()->userchair_confirmed()));
	// If autoplayer is engaged, we know our chair, and the DLL hasn't told us to wait, then go do it!
	if (p_autoplayer->autoplayer_engaged()) {
		write_log(Preferences()->debug_heartbeat(), "[HeartBeatThread] Calling DoAutoplayer.\n");
		p_autoplayer->DoAutoplayer();
	}
}
Beispiel #14
0
bool CHandresetDetector::IsHandresetByHandNumber()
{
	if ((HandResetMethod() &  HANDRESET_HANDNUM) == 0)
	{
		write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] No handreset by handnumber, because that method is not active\n");
		// We don't want to use this method
		return false;
	}
	bool ishandreset = (IsValidHandNumber(handnumber) && (handnumber != last_handnumber));
	write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by handnumber: %s\n",
		Bool2CString(ishandreset));
	return ishandreset;
}
void CSymbolEngineTableLimits::AutoLockBlinds() {
	write_log(preferences.debug_table_limits(), 
    "[CSymbolEngineTableLimits] AutoLockBlinds()\n");
	write_log(preferences.debug_table_limits(), 
    "[CSymbolEngineTableLimits] blinds_locked_for_current_hand: %s\n", 
    Bool2CString(blinds_locked_for_current_hand));
	// Reasonable blinds guaranteed bz the waz we guess.
  // And IsMzTurn guarantees stable input
  if (!blinds_locked_for_current_hand && p_scraper_access->IsMyTurn()) {
		AutoLockBlindsForCurrentHand();
		AutoLockBlindsForCashgamesAfterNHands();
	}
}
Beispiel #16
0
bool CHandresetDetector::IsHandresetByDealerChair()
{
	if ((HandResetMethod() &  HANDRESET_DEALER) == 0)
	{
		write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] No handreset by dealerchair, because that method is not active\n");
		// We don't want to use this method
		return false;
	}
	bool ishandreset = (IsValidDealerChair(dealerchair) && (dealerchair != last_dealerchair));
	write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by dealerchair: %s\n",
		Bool2CString(ishandreset));
	return ishandreset;
}
bool CHandresetDetector::IsHandresetByIncreasingBalance() {
  bool ishandreset = false;
  for (int i=0; i<k_max_number_of_players; ++i) {
    if ((_balance[i] > _last_balance[i])
        && (_last_balance[i] > 0)) {
      ishandreset = true;
      break;
    }
  }
  write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by increasing balance: %s\n",
		Bool2CString(ishandreset));
  return ishandreset;
}
Beispiel #18
0
bool CAutoplayer::AnySecondaryFormulaTrue() {
  // Considering all hopper functions
  // and the functions f$prefold and f$chat.
	for (int i=k_hopper_function_sitin; i<=k_standard_function_chat; ++i)	{
		bool function_result = p_autoplayer_functions->GetAutoplayerFunctionValue(i);
		write_log(preferences.debug_autoplayer(), "[AutoPlayer] AnySecondaryFormulaTrue(): [%s]: %s\n",
			k_standard_function_names[i], Bool2CString(function_result));
		if (function_result) {
			write_log(preferences.debug_autoplayer(), "[AutoPlayer] AnySecondaryFormulaTrue(): yes\n");
			return true;
		}
	}
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] AnySecondaryFormulaTrue(): no\n");
	return false;
}
Beispiel #19
0
bool CHandresetDetector::IsHandresetByCards()
{
	if ((HandResetMethod() &  HANDRESET_CARDS) == 0)
	{
		write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] No handreset by cards, because that method is not active\n");
		// We don't want to use this method
		return false;
	}
	bool ishandreset = (p_scraper_access->UserHasCards()
		&& (playercards[0] != last_playercards[0]) 
		&& (playercards[1] != last_playercards[1]));
	write_log(preferences.debug_handreset_detector(), "[CHandresetDetector] Handreset by cards: %s\n",
		Bool2CString(ishandreset));
	return ishandreset;
}
Beispiel #20
0
bool CAutoplayer::AnySecondaryFormulaTrue()
{
    for (int i=k_autoplayer_function_prefold; i<=k_autoplayer_function_chat; ++i)
    {
        bool function_result = p_autoplayer_functions->GetAutoplayerFunctionValue(i);
        write_log(prefs.debug_autoplayer(), "[AutoPlayer] AnySecondaryFormulaTrue(): [%s]: %s\n",
                  k_autoplayer_functionname[i], Bool2CString(function_result));
        if (function_result)
        {
            write_log(prefs.debug_autoplayer(), "[AutoPlayer] AnySecondaryFormulaTrue(): yes\n");
            return true;
        }
    }
    write_log(prefs.debug_autoplayer(), "[AutoPlayer] AnySecondaryFormulaTrue(): no\n");
    return false;
}
Beispiel #21
0
bool CAutoplayer::TimeToHandleSecondaryFormulas()
{
    // Disabled (N-1) out of N heartbeats (3 out of 4 seconds)
    // to avoid multiple fast clicking on the sitin / sitout-button.
    // Contrary to the old f$play-function we use a heartbeat-counter
    // for that logic, as with a small scrape-delay it was
    // still possible to act multiple times within the same second.
    // Scrape_delay() should always be > 0, there's a check in the GUI.
    assert(prefs.scrape_delay() > 0);
    int hearbeats_to_pause = 4 / prefs.scrape_delay();
    if  (hearbeats_to_pause < 1)
    {
        hearbeats_to_pause = 1;
    }
    write_log(prefs.debug_autoplayer(), "[AutoPlayer] TimeToHandleSecondaryFormulas() heartbeats to pause: %i\n",
              hearbeats_to_pause);
    bool act_this_heartbeat = ((p_heartbeat_thread->heartbeat_counter() % hearbeats_to_pause) == 0);
    write_log(prefs.debug_autoplayer(), "[AutoPlayer] TimeToHandleSecondaryFormulas() act_this_heartbeat: %s\n",
              Bool2CString(act_this_heartbeat));
    return act_this_heartbeat;
}
Beispiel #22
0
bool CAutoplayer::AnyPrimaryFormulaTrue() { 
	for (int i=k_autoplayer_function_beep; i<=k_autoplayer_function_fold; ++i)
	{
		double function_result = p_autoplayer_functions->GetAutoplayerFunctionValue(i);
		if (i == k_autoplayer_function_betsize)
		{
			write_log(preferences.debug_autoplayer(), "[AutoPlayer] AnyPrimaryFormulaTrue(): [%s]: %s\n",
				k_standard_function_names[i], Number2CString(function_result));
		}
		else
		{
			write_log(preferences.debug_autoplayer(), "[AutoPlayer] AnyPrimaryFormulaTrue(): [%s]: %s\n",
				k_standard_function_names[i], Bool2CString(function_result));
		}
		if (function_result)
		{
			write_log(preferences.debug_autoplayer(), "[AutoPlayer] AnyPrimaryFormulaTrue(): yes\n");
			return true;
		}
	}
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] AnyPrimaryFormulaTrue(): no\n");
	return false;
}
Beispiel #23
0
bool CAutoplayer::TimeToHandleSecondaryFormulas() {
	// Disabled (N-1) out of N heartbeats (3 out of 3 seconds)
	// to avoid multiple fast clicking on the sitin / sitout-button.
	// Contrary to the old f$play-function we use a heartbeat-counter
	// for that logic, as with a small scrape-delay it was
	// still possible to act multiple times within the same second.
	// Scrape_delay() should always be > 0, there's a check in the GUI.
	assert(preferences.scrape_delay() > 0);
  // We need milli-seconds here, just like in the preferences
  // and also floating-point-division (3000.0) before we truncate to integer.
  // Otherwise we get always 0 and a constant secondary formula
  // would be executed every heartbeat and block all primary ones.
	int hearbeats_to_pause = 3000.0 / preferences.scrape_delay();
	if  (hearbeats_to_pause < 1) {
 		hearbeats_to_pause = 1;
 	}
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] TimeToHandleSecondaryFormulas() heartbeats to pause: %i\n",
		hearbeats_to_pause);
	bool act_this_heartbeat = ((p_heartbeat_thread->heartbeat_counter() % hearbeats_to_pause) == 0);
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] TimeToHandleSecondaryFormulas() act_this_heartbeat: %s\n",
		Bool2CString(act_this_heartbeat));
	return act_this_heartbeat;
}
Beispiel #24
0
// Menu -> Edit -> View Scraper Output
void CMainFrame::OnScraperOutput() {
	if (m_ScraperOutputDlg) {
		write_log(preferences.debug_gui(), "[GUI] m_ScraperOutputDlg = %i\n", m_ScraperOutputDlg);
		write_log(preferences.debug_gui(), "[GUI] Going to destroy existing scraper output dialog\n");

		BOOL	bWasShown = ::IsWindow(m_ScraperOutputDlg->m_hWnd) && m_ScraperOutputDlg->IsWindowVisible();
		write_log(preferences.debug_gui(), "[GUI] Scraper output dialog was visible: %s\n", Bool2CString(bWasShown));

    CDlgScraperOutput::DestroyWindowSafely();
		if (bWasShown) {
			write_log(preferences.debug_gui(), "[GUI] Scraper output dialog destroyed; going to return\n");
			return;
		}
	}	else {
		write_log(preferences.debug_gui(), "[GUI] Scraper output dialog does not yet exist\n");
	}
	
	OH_MessageBox_Interactive("Please note:\n"
	  "OpenScrape scrapes everything, but OpenHoldem is optimized\n"		  
	  "to scrape only necessary info.\n"
	  "\n"
	  "For example:\n"
	  "If a players first card is \"cardback\" we don't even have to scrape the second one.\n"
	  "This is a feature, not a bug.\n",
	  "Info", 0);

	write_log(preferences.debug_gui(), "[GUI] Going to create scraper output dialog\n");
	m_ScraperOutputDlg = new CDlgScraperOutput(this);
	write_log(preferences.debug_gui(), "[GUI] Scraper output dialog: step 1 finished\n");
	m_ScraperOutputDlg->Create(CDlgScraperOutput::IDD,this);
	write_log(preferences.debug_gui(), "[GUI] Scraper output dialog: step 2 finished\n");
	m_ScraperOutputDlg->ShowWindow(SW_SHOW);
	write_log(preferences.debug_gui(), "[GUI] Scraper output dialog: step 3 finished\n");
	p_flags_toolbar->EnableButton(ID_MAIN_TOOLBAR_SCRAPER_OUTPUT, true);
	write_log(preferences.debug_gui(), "[GUI] Scraper output dialog: step 4 (final) finished\n"); 
}
void CAutoplayerFunctions::CalcPrimaryFormulasOHScript() {
  write_log(preferences.debug_formula(), "[CAutoplayerFunctions] CalcPrimaryFormulasOHScript()\n");
  bool trace_needed = preferences.trace_enabled();
  write_log(preferences.debug_formula(), "[CAutoplayerFunctions] Trace enabled: %s\n", Bool2CString(preferences.trace_enabled()));
	for (int i=k_autoplayer_function_beep; i<=k_autoplayer_function_fold; i++) {
		double result = p_function_collection->Evaluate(k_standard_function_names[i], trace_needed);
		write_log(preferences.debug_formula(), "[CAutoplayerFunctions] Primary formulas; %s: %f\n", 
			k_standard_function_names[i], result);
	}
}
void CHeartbeatThread::ScrapeEvaluateAct() {
	bool iswait = false;

	p_table_positioner->AlwaysKeepPositionIfEnabled();
	// This critical section lets other threads know that the internal state is being updated
	EnterCriticalSection(&pParent->cs_update_in_progress);

	////////////////////////////////////////////////////////////////////////////////////////////
	// Scrape window
  write_log(preferences.debug_heartbeat(), "[HeartBeatThread] Calling DoScrape.\n");
  p_lazyscraper->DoScrape();
  // We must not check if the scrape of the table changed, because:
  //   * some symbol-engines must be evaluated no matter what
  //   * we might need to act (sitout, ...) on empty/non-changing tables
  //   * auto-player needs stable frames too
  //
  // Necessary to pre-compute some info 
	// which is needed by the symbol-engines.
  // ismyturn, myturnbits (visible buttons), ...
	p_scraper_access->GetNeccessaryTablemapObjects();
	p_engine_container->EvaluateAll();
	// Reply-frames no longer here in the heartbeat.
  // we have a "ReplayFrameController for that.
  LeaveCriticalSection(&pParent->cs_update_in_progress);
	p_openholdem_title->UpdateTitle();
	////////////////////////////////////////////////////////////////////////////////////////////
	// Update scraper output dialog if it is present
	if (m_ScraperOutputDlg) {
		m_ScraperOutputDlg->UpdateDisplay();
	}
  ////////////////////////////////////////////////////////////////////////////////////////////
	// Save state
	write_log(preferences.debug_heartbeat(), "[HeartBeatThread] Calling CaptureState.\n");
	p_game_state->CaptureState();
  
	////////////////////////////////////////////////////////////////////////////////////////////
	// OH-Validator
	write_log(preferences.debug_heartbeat(), "[HeartBeatThread] Calling ValidateGameState.\n");
	p_validator->ValidateGameState();

	////////////////////////////////////////////////////////////////////////////////////////////
	// DLL - always send state
	write_log(preferences.debug_heartbeat(), "[HeartBeatThread] Calling PassStateToDll.\n");
	p_dll_extension->PassStateToDll(p_game_state->state((p_game_state->state_index()-1)&0xff));

	////////////////////////////////////////////////////////////////////////////////////////////
	// Autoplayer
	if (p_dll_extension->IsLoaded() && p_symbol_engine_autoplayer->ismyturn())	{
		iswait = (p_dll_extension->process_message()) ("query", "dll$iswait");
	}	else {
		iswait = false;
	}

	write_log(preferences.debug_heartbeat(), "[HeartBeatThread] autoplayer_engaged(): %s\n", 
		Bool2CString(p_autoplayer->autoplayer_engaged()));
	write_log(preferences.debug_heartbeat(), "[HeartBeatThread] user_chair_confirmed(): %s\n", 
		Bool2CString(p_symbol_engine_userchair->userchair_confirmed()));
	write_log(preferences.debug_heartbeat(), "[HeartBeatThread] iswait: %s\n", 
		Bool2CString(iswait));
	// If autoplayer is engaged, we know our chair, and the DLL hasn't told us to wait, then go do it!
	if (p_autoplayer->autoplayer_engaged() && !iswait) {
		write_log(preferences.debug_heartbeat(), "[HeartBeatThread] Calling DoAutoplayer.\n");
		p_autoplayer->DoAutoplayer();
	}
}
void CSymbolEngineIsTournament::TryToDetectTournament()
{
	if (_istournament != k_undefined)
		write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] Currently istournament = %s\n", Bool2CString(_istournament));
	else
		write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] Currently istournament = unknown\n");
	// Don't do anything if we are already sure.
	// Don't mix things up.
	if (_decision_locked)
	{
		write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] decision already locked\n");
		return;
	}
	// If we have more than 2 hands played we should be sure
	// and stick to our decision, whatever it is (probably cash-game).
	// Also checking for (elapsedauto < elapsed). i.e. at least one action
	// since connection, as handsplayed does not reset if we play multiple games.
	if ((_istournament != k_undefined)
		&& (p_game_state->hands_played() > 2)
		&& (p_symbol_engine_time->elapsedauto() < p_symbol_engine_time->elapsed()))
	{
		write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] Enough hands played; locking current value\n");
		_decision_locked = true;
		return;
	}
	// If the blinds are "too low" then we play a cash-game.
	double bigblind = p_tablelimits->bblind();
	if ((bigblind > 0) && (bigblind < k_lowest_bigblind_ever_seen_in_tournament))
	{
		write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] Blinds \"too low\"; this is a cash-game\n");
		_istournament    = false;
		_decision_locked = true;
		return;
	}
	// If the title-string looks like a tournament then it is a tournament.
	if (TitleStringLooksLikeTournament())
	{
		write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] Table title looks like a tournament\n");
		_istournament    = true;
		_decision_locked = true;
		return;
	}
	// If there are antes then it is a tournament.
	if (AntesPresent())
	{
		write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] Game with antes; therefore tournament\n");
		_istournament    = true;
		_decision_locked = true;
		return;
	}
	// If bets and balances are "tournament-like", then it is a tournament
	if (BetsAndBalancesAreTournamentLike())
	{
		write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] Bets and balances look like tournament\n");
		_istournament    = true;
		_decision_locked = true;
		return;
	}
	// Not yet sure, but we have handled so far:
	// * all lower stakes cash-games
	// * all SNGs / MTTs with good title-string
	// * all SNGs and starting tables of MTTs (by bets and balances)
	// * some later tables of MTTs (by antes)
	// * some more later tables of MTTs (if no reconnection is necessary)
	// This leaves us with only 2 cases
	// * medium and high-stakes cash-games ($5/$10 and above)
	// * some (very few) later tables of MTTs
	if (bigblind > k_large_bigblind_probably_later_table_in_tournament)
	{
		// Probably tournament, but not really sure yet,
		// so don't lock the decision.
		write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] bigblind very large; probably tournament\n");
		_istournament = true;
		return;
	}
	// Smaller bigblinds (< $500) will be considered cash-games, 
	// because they are too small for later tables of tournaments
	_istournament    = false;
	_decision_locked = true;
	write_log(prefs.debug_istournament(), "[CSymbolEngineIsTournament] high-stakes cash-game up to $200\\$400.n");
	// The only case that can go wrong now:
	// High-stakes cash-games ($250/$500 and above) can be recognized 
	// as tournaments. 
	// Main consequence: blinds won't be locked for the entire session,
	// but only for the current hand. Does this hurt much?
}
bool CAutoConnector::IsConnected() {
  bool result = (_attached_hwnd != NULL) && IsWindow(_attached_hwnd);
   write_log(preferences.debug_autoconnector(), "[CAutoConnector] IsConnected: %s\n",
    Bool2CString(result));
	return result;
}
void CAutoplayerFunctions::CalcPrimaryFormulasOpenPPL() {
  write_log(preferences.debug_formula(), "[CAutoplayerFunctions] CalcPrimaryFormulasOpenPPL()\n");
  bool trace_needed = preferences.trace_enabled();
  write_log(preferences.debug_formula(), "[CAutoplayerFunctions] Trace enabled: %s\n", Bool2CString(preferences.trace_enabled()));
  // First do the calculation of memory/history-symbols,
  //   * exactly once per my turn
  //   * when we have stable frames (isfinal-answer == true)
  //   * shortly before the main OpenPPL-evaluations
  // Unfortunately doing this in CSymbolEngineOpen::PPLResetOnMyTurn() 
  // did not work as expected.
  assert(p_symbol_engine_autoplayer->isfinalanswer());
  p_symbol_engine_open_ppl->InitMemorySymbols();
  // Now do the main evaluation
  int betround = p_betround_calculator->betround();
	if (betround < kBetroundPreflop || betround > kBetroundRiver) {
    write_log(preferences.debug_formula(), 
      "[CAutoplayerFunctions] Betround out of range. Can't calculate OpenPPL-decision\n");
    return;
  }
  double decision = p_function_collection->Evaluate(k_OpenPPL_function_names[betround], 
    trace_needed);
  write_log(preferences.debug_formula(), 
    "[CAutoplayerFunctions] Decision (non-translated) = %.2f\n", decision);
  TranslateOpenPPLDecisionToAutoplayerFunctions(decision);
}
Beispiel #30
0
// Menu -> Edit -> View Scraper Output
void CMainFrame::OnScraperOutput()
{
    if (m_ScraperOutputDlg)
    {
        write_log(preferences.debug_gui(), "[GUI] m_ScraperOutputDlg = %i\n", m_ScraperOutputDlg);
        write_log(preferences.debug_gui(), "[GUI] Going to destroy existing scraper output dialog\n");

        BOOL	bWasShown = ::IsWindow(m_ScraperOutputDlg->m_hWnd) && m_ScraperOutputDlg->IsWindowVisible();
        write_log(preferences.debug_gui(), "[GUI] Scraper output dialog was visible: %s\n", Bool2CString(bWasShown));

        m_ScraperOutputDlg->DestroyWindow();
        delete m_ScraperOutputDlg;
        m_ScraperOutputDlg = NULL;

        if (bWasShown)
        {
            write_log(preferences.debug_gui(), "[GUI] Scraper output dialog destroyed; going to return\n");
            return;
        }
    }
    else
    {
        write_log(preferences.debug_gui(), "[GUI] Scraper output dialog does not yet exist\n");
    }

    write_log(preferences.debug_gui(), "[GUI] Going to create scraper output dialog\n");
    m_ScraperOutputDlg = new CDlgScraperOutput(this);
    write_log(preferences.debug_gui(), "[GUI] Scraper output dialog: step 1 finished\n");
    m_ScraperOutputDlg->Create(CDlgScraperOutput::IDD,this);
    write_log(preferences.debug_gui(), "[GUI] Scraper output dialog: step 2 finished\n");
    m_ScraperOutputDlg->ShowWindow(SW_SHOW);
    write_log(preferences.debug_gui(), "[GUI] Scraper output dialog: step 3 finished\n");
    p_flags_toolbar->EnableButton(ID_MAIN_TOOLBAR_SCRAPER_OUTPUT, true);
    write_log(preferences.debug_gui(), "[GUI] Scraper output dialog: step 4 (final) finished\n");
}