Exemplo n.º 1
0
void CIteratorThread::InitIteratorLoop() {
	write_log(preferences.debug_prwin(), "[PrWinThread] Initializing iterator loop\n");

	// Set starting status and parameters
	InitNumberOfIterations();
	// player cards
	CardMask_RESET(_plCards);
	CardMask_RESET(_comCards);
	_nplCards = _ncomCards = 0;

	// Counters
	_win = _tie = _los = 0;

  int userchair = p_symbol_engine_userchair->userchair();
  if (userchair == k_undefined) return;

	// setup masks
  AssertRange(userchair, 0, k_max_chair_number);
	for (int i=0; i<k_number_of_cards_per_player; i++) {
    Card card = p_table_state->User()->_hole_cards[i];
    if (card.IsKnownCard()) {
      CardMask_SET(_plCards, card.GetValue());
			_nplCards++;
		}
	}
	for (int i=0; i<k_number_of_community_cards; i++) {
    Card card = p_table_state->_common_cards[i];
    if (card.IsKnownCard()) {
      CardMask_SET(_comCards, card.GetValue());
			_ncomCards++;
		}
	}

	//Weighted prwin only for nopponents <=13
	_willplay = p_function_collection->Evaluate("f$prwin_willplay");
	_wontplay = p_function_collection->Evaluate("f$prwin_wontplay");
	_mustplay = p_function_collection->Evaluate("f$prwin_mustplay");
	_topclip = p_function_collection->Evaluate("f$prwin_topclip");

	// Call prw1326 callback if needed
	if (_prw1326.useme==1326 
		  && _prw1326.usecallback==1326 
		  && (p_betround_calculator->betround()!= k_betround_preflop
			  || _prw1326.preflop==1326) ){
		_prw1326.prw_callback(); //Matrix 2008-05-09
	}
}
Exemplo n.º 2
0
void CIteratorThread::InitIteratorLoop()
{
	int			e = SUCCESS;
	CGrammar	gram;

	write_log(preferences.debug_prwin(), "[PrWinThread] Initializing iterator loop\n");
	// Set starting status and parameters
	iter_vars.set_iterator_thread_running(true);
	iter_vars.set_iterator_thread_complete(false);
	iter_vars.set_iterator_thread_progress(0);
	iter_vars.set_nit(10000); //!! f$prwin_number_of_iterations")

	// Users cards
	for (int i=0; i<k_number_of_cards_per_player; i++)
	{
		iter_vars.set_pcard(i, p_scraper->card_player(p_symbol_engine_userchair->userchair(), i));
	}
	// Community cards
	for (int i=0; i<k_number_of_community_cards; i++)
	{
		iter_vars.set_ccard(i, p_scraper->card_common(i));
	}

	iter_vars.set_prwin(0);
	iter_vars.set_prtie(0);
	iter_vars.set_prlos(0);

	// player cards
	CardMask_RESET(_plCards);
	CardMask_RESET(_comCards);
	_nplCards = _ncomCards = 0;

	// Counters
	_win = _tie = _los = 0;

	// setup masks
	for (int i=0; i<k_number_of_cards_per_player; i++)
	{
		if (iter_vars.pcard(i) != CARD_BACK && iter_vars.pcard(i) != CARD_NOCARD)
		{
			CardMask_SET(_plCards, iter_vars.pcard(i));
			_nplCards++;
		}
	}
	for (int i=0; i<k_number_of_community_cards; i++)
	{
		if (iter_vars.ccard(i) != CARD_BACK && iter_vars.ccard(i) != CARD_NOCARD)
		{
			CardMask_SET(_comCards, iter_vars.ccard(i));
			_ncomCards++;
		}
	}

	//Weighted prwin only for nopponents <=13
	e = SUCCESS;
	_willplay = (int) gram.CalcF$symbol(p_formula, "f$prwin_willplay", &e);
	e = SUCCESS;
	_wontplay = (int) gram.CalcF$symbol(p_formula, "f$prwin_wontplay", &e);
	e = SUCCESS;
	_mustplay = (int) gram.CalcF$symbol(p_formula, "f$prwin_mustplay", &e);
	e = SUCCESS;
	_topclip = (int) gram.CalcF$symbol(p_formula, "f$prwin_topclip", &e);

	// Call prw1326 callback if needed
	if (_prw1326.useme==1326 
		&& _prw1326.usecallback==1326 
		&& (p_betround_calculator->betround()!= k_betround_preflop
			|| _prw1326.preflop==1326) )
	{
		_prw1326.prw_callback(); //Matrix 2008-05-09
	}
}