예제 #1
0
bool CAutoplayer::DoBetsize(void) { 
  double betsize = p_function_collection->EvaluateAutoplayerFunction(k_autoplayer_function_betsize);
	if (betsize > 0) 	{
    if (!_already_executing_allin_adjustment) {
      // We have to prevent a potential endless loop here>
      // swag -> adjusted allin -> swag allin -> adjusted allin ...
      if (ChangeBetsizeToAllin(betsize)) {
        _already_executing_allin_adjustment = true;
        write_log(preferences.debug_autoplayer(), "[AutoPlayer] Adjusting betsize to allin.\n");
        bool success = DoAllin();
        _already_executing_allin_adjustment = false;
        return success;
      }
    }
		int success = p_casino_interface->EnterBetsize(betsize);
		if (success) {
      write_log(preferences.debug_autoplayer(), "[AutoPlayer] betsize %.2f (adjusted) entered\n",
        betsize);
			p_symbol_engine_history->RegisterAction(k_autoplayer_function_betsize);
			return true;
		}
    write_log(preferences.debug_autoplayer(), "[AutoPlayer] Failed to enter betsize %.2f\n",
      betsize);
    return false;
	}
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] Don't f$betsize, because f$betsize evaluates to 0.\n");
	return false;
}
예제 #2
0
파일: CAutoplayer.cpp 프로젝트: ohzooboy/oh
bool CAutoplayer::ExecutePrimaryFormulas() 
{
	write_log(prefs.debug_autoplayer(), "[AutoPlayer] ExecutePrimaryFormulas()\n");
	// Precondition: my turn and isfinalanswer
	// So we have to take an action and are able to do so.
	// This function will ALWAYS try to click a button,
	// so we can handle the preparation once at the very beginning.
	if (!PrepareActionSequence())
	{
		return false;
	}
	if (p_autoplayer_functions->f$alli())
	{
		if (DoAllin())
		{
			return true;
		}
		// Else continue with swag and betpot
	}
	if (DoSwag())
	{
		return true;
	}
	if (DoBetPot())
	{
		return true;
	}
	return ExecuteRaiseCallCheckFold();
}
예제 #3
0
bool CAutoplayer::ExecutePrimaryFormulasIfNecessary() {
	write_log(preferences.debug_autoplayer(), "[AutoPlayer] ExecutePrimaryFormulasIfNecessary()\n");
	if (!AnyPrimaryFormulaTrue())
	{
		write_log(preferences.debug_autoplayer(), "[AutoPlayer] No primary formula true. Nothing to do\n");
		return false;
	}
	// Execute beep (if necessary) independent of all other conditions (mutex, etc.)
	// and with autoplayer-actions.
	ExecuteBeep();

	assert(p_symbol_engine_autoplayer->isfinalanswer());
	assert(p_symbol_engine_autoplayer->ismyturn());
	// Precondition: my turn and isfinalanswer
	// So we have to take an action and are able to do so.
	// This function will ALWAYS try to click a button,
	// so we can handle the preparation once at the very beginning.
	CMyMutex mutex;

	if (!mutex.IsLocked())
	{
		return false;
	}

	PrepareActionSequence();

	if (p_function_collection->EvaluateAutoplayerFunction(k_autoplayer_function_allin))
	{
		if (DoAllin())
		{
			return true;
		}
		// Else continue with swag and betpot
	}
	if (DoBetPot())
	{
		return true;
	}
	if (DoBetsize())
	{
		return true;
	}
	return ExecuteRaiseCallCheckFold();
}
예제 #4
0
bool CAutoplayer::DoBetPot(void) {
	bool success = false;
	// Start with 2 * potsize, continue with lower betsizes, finally 1/4 pot
	for (int i=k_autoplayer_function_betpot_2_1; i<=k_autoplayer_function_betpot_1_4; i++) {
		if (p_autoplayer_functions->GetAutoplayerFunctionValue(i)) 	{
			write_log(preferences.debug_autoplayer(), 
        "[AutoPlayer] Function %s true.\n", k_standard_function_names[i]);
      if (ChangeBetPotActionToAllin(i)) {
        write_log(preferences.debug_autoplayer(), "[AutoPlayer] Adjusting bhetpot_X_Y to allin.\n");
        return DoAllin();
      }
			if (p_tablemap->betpotmethod() == BETPOT_RAISE)	{
				success = p_casino_interface->ClickButtonSequence(i, k_autoplayer_function_raise, preferences.swag_delay_3());
			}	else {
				// Default: click only betpot
				success = p_casino_interface->ClickButton(i);				
			}
      if (!success) {
        // Backup action> try yo swag betpot_X_Y
        double betpot_amount = BetsizeForBetpot(i);
        write_log(preferences.debug_autoplayer(), 
          "[AutoPlayer] Betpot with buttons failed\n");
        write_log(preferences.debug_autoplayer(), 
          "[AutoPlayer] Trying to swag %.2f instead\n", betpot_amount);
        success = p_casino_interface->EnterBetsize(betpot_amount);
      }
		}
    if (success) {
			// Register the action
			// Treat betpot like swagging, i.e. raising a user-defined amount
			p_symbol_engine_history->RegisterAction(k_autoplayer_function_betsize);
			return true;
    }
		// Else continue trying with the next betpot function
	}
	// We didn't click any betpot-button
	return false;
}