void CIteratorThread::StandardDealingAlgorithmForUpTo13Opponents(int nopponents)
{
	unsigned int	card = 0;

	write_log(Preferences()->debug_prwin(), "[PrWinThread] Using random algorithm, as f$prwin_number_of_opponents <= 13\n");
	// random replacement algorithm
	// opponent cards
	if (nopponents < 1) {
		write_log(Preferences()->debug_prwin(), "[PrWinThread] No opponents. Auto-adapting to 1.\n");
    nopponents = 1;
	}
	for (int i=0; 
		i<nopponents*NumberOfCardsPerPlayer(); 
		i+=NumberOfCardsPerPlayer())
	{
		temp_usedCards=usedCards;
		do
		{
			usedCards = temp_usedCards; //reset the card mask to clear settings from failed card assignments

			for (int j=0; j<NumberOfCardsPerPlayer(); j++)
			{
				card = GetRandomCard();
				CardMask_SET(usedCards, card);
				ocard[i+j] = card;
			}

			if (!_willplay)
			{
				write_log(Preferences()->debug_prwin(), "[PrWinThread] Weighting disabled. Willplay is 0.\n");
				break; //0 disables weighting
			}

			//put break for i=0 and opponent unraised BB case (cannot assume anything about his cards)
			//In round 1 we should really do an analysis of chairs to find out how many have still to
			//place a bet. Not implemented since accuracy of prwin pre-flop is less critical.
			//
      // bblimp and special handling for checking players removed in OH 9.2.8
      // as it was broken and we consider it useless / even harmful.
      // http://www.maxinmontreal.com/forums/viewtopic.php?f=156&t=19064
		} while (!IsHandInWeightedRange(ocard[i], ocard[i+1],
			_willplay, _wontplay, 
			_topclip, _mustplay));
	}
	// additional common cards
	CardMask_RESET(addlcomCards);
	for (int i=0; i<(kNumberOfCommunityCards - _ncomCards); i++)
	{
		card = GetRandomCard();
		CardMask_SET(usedCards, card);
		CardMask_SET(addlcomCards, card);
	}
}
void CIteratorThread::StandardDealingAlgorithmForUpTo13Opponents(int nopponents)
{
	unsigned int	card = 0;

	write_log(preferences.debug_prwin(), "[PrWinThread] Using random algorithm, as f$prwin_number_of_opponents <= 13\n");
	// random replacement algorithm
	// opponent cards
	if (nopponents < 1) {
		write_log(preferences.debug_prwin(), "[PrWinThread] No opponents. Auto-adapting to 1.\n");
    nopponents = 1;
	}
	for (int i=0; 
		i<nopponents*k_number_of_cards_per_player; 
		i+=k_number_of_cards_per_player)
	{
		temp_usedCards=usedCards;
		do
		{
			usedCards = temp_usedCards; //reset the card mask to clear settings from failed card assignments

			for (int j=0; j<k_number_of_cards_per_player; j++)
			{
				card = GetRandomCard();
				CardMask_SET(usedCards, card);
				ocard[i+j] = card;
			}

			if (!_willplay)
			{
				write_log(preferences.debug_prwin(), "[PrWinThread] Weighting disabled. Willplay is 0.\n");
				break; //0 disables weighting
			}

			//put break for i=0 and opponent unraised BB case (cannot assume anything about his cards)
			//In round 1 we should really do an analysis of chairs to find out how many have still to
			//place a bet. Not implemented since accuracy of prwin pre-flop is less critical.
			if (!i)
			{
				//if we called then we are not BB, BB limped to flop,
				//BB still playing, so do not weight his cards
				int betround = p_betround_calculator->betround();
				if (p_symbol_engine_history->nbetsround(betround) < 1.1 
					&& p_symbol_engine_history->didcall(betround) 
					&& (p_symbol_engine_active_dealt_playing->playersplayingbits() 
						& p_symbol_engine_blinds->bblindbits()))
				{
					break;
				}
			}
		} while (!IsHandInWeightedRange(ocard[i], ocard[i+1],
			_willplay, _wontplay, 
			_topclip, _mustplay));
	}
	// additional common cards
	CardMask_RESET(addlcomCards);
	for (int i=0; i<(k_number_of_community_cards - _ncomCards); i++)
	{
		card = GetRandomCard();
		CardMask_SET(usedCards, card);
		CardMask_SET(addlcomCards, card);
	}
}