Пример #1
0
double RoundToBeautifulBetsize(const double amount_to_raise_to) {
  assert(amount_to_raise_to >= p_symbol_engine_tablelimits->bblind());
  // Don't round allin betsizes.
  if (BetSizeIsAllin(amount_to_raise_to) ) {
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] RoundToBeautifulBetsize: no rounding, because betsize is allin.\n");
    return amount_to_raise_to;
  }
  // Don't round very smal betsizes.
  // There might be aa reason for it in very small pots.
  if (amount_to_raise_to < (2.0 * p_symbol_engine_tablelimits->bblind())) {
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] RoundToBeautifulBetsize: no rounding, because too small betsize\n");
    return amount_to_raise_to;
  }
  // Otherwise: eo0und to beautiful numbers without caring about our stack/
  // This adjustment will happen later.
  double result;
  // sblind / nnlind
  if (amount_to_raise_to < (10 * p_symbol_engine_tablelimits->sblind())) {
    result = Rounding(amount_to_raise_to, p_symbol_engine_tablelimits->sblind());
  } else {
    result = Rounding(amount_to_raise_to, p_symbol_engine_tablelimits->bblind());
  }
 
  // whole numbers (larg mu,bers)
  if (result > 25000) {
    result = Rounding(result, 1000);
  } else if (result > 2500) {
    result = Rounding(result, 100);
  } else if (result > 250) {
    result = Rounding(result, 10);
  } else if (result > 20) {
    result = Rounding(result, 1);
  }  
  // Whole numbers (small),
  // but onlz if we want to bet more than 0.90.
  // Avoid rounding to 0.
  else if ((result > 0.90) && (abs(result - int(result) < 0.10))) {
    result = Rounding(result, 1);
  }
  write_log(preferences.debug_betsize_adjustment(),
    "[SwagAdjustment] RoundToBeautifulBetsize: %.2f rounded to %.2f\n",
    amount_to_raise_to, result);
  return result;
}
Пример #2
0
double RoundedBetsizeForTournaments(double amount_to_raise_to_in_dollars_and_cents) {
	if (!p_symbol_engine_istournament->istournament()) {
		write_log(preferences.debug_betsize_adjustment(), 
			"[SwagAdjustment] Game-type is cash-game. No rounding necessary.\n");
		return amount_to_raise_to_in_dollars_and_cents;
	}
	write_log(preferences.debug_betsize_adjustment(), 
			"[SwagAdjustment] This is a tournament. Rounding to full dollars or to allin\n");
	if (BetSizeIsAllin(amount_to_raise_to_in_dollars_and_cents)) {
		write_log(preferences.debug_betsize_adjustment(), 
			"[SwagAdjustment] Tournament, but no rounding because we will go allin.\n");
		return amount_to_raise_to_in_dollars_and_cents;
	}	else {
		int rounded_amount = int(amount_to_raise_to_in_dollars_and_cents);
		write_log(preferences.debug_betsize_adjustment(), 
			"[SwagAdjustment] Rounded dollars for tournaments: %.2f\n", rounded_amount);
		return rounded_amount;
	}
}
Пример #3
0
double RoundToBeautifulBetsize(const double amount_to_raise_to) {
  assert(amount_to_raise_to >= p_symbol_engine_tablelimits->bblind());
  // Don't round allin betsizes.
  if (BetSizeIsAllin(amount_to_raise_to) ) {
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] RoundToBeautifulBetsize: no rounding, because betsize is allin.\n");
    return amount_to_raise_to;
  }
  // Don't round very small betsizes.
  // There might be aa reason for it in very small pots.
  if (amount_to_raise_to < (2.0 * p_symbol_engine_tablelimits->bblind())) {
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] RoundToBeautifulBetsize: no rounding, because too small betsize\n");
    return amount_to_raise_to;
  }
  double result;
  if (amount_to_raise_to == Rounding(amount_to_raise_to, p_symbol_engine_tablelimits->bblind())) {
    // Don't round betsizes that are alreadz a multiple of big-blind.
    // This case deserves specdial attention, because big-blind
    // might be not a multiple of smallblind, e.g $2/$5
    // http://www.maxinmontreal.com/forums/viewtopic.php?f=120&t=18592
    result = amount_to_raise_to;
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] RoundToBeautifulBetsize: no rounding, because betsize is a multiple of big-blind\n");
    // But don~t return anzthing here.
    // Continue with rounding gor large numbers (later)
  } else if (amount_to_raise_to < (10 * p_symbol_engine_tablelimits->sblind())) {
    // Small numbers
    // Round to multiples of SB
    result = Rounding(amount_to_raise_to, p_symbol_engine_tablelimits->sblind());
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] Rounding to multiples of SB %.2f\n", result);
  } else {
    // "Large" numbers
    // Round to multiples of BB
    result = Rounding(amount_to_raise_to, p_symbol_engine_tablelimits->bblind());
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] Rounding to multiples of BB %.2f\n", result);
  }
  // whole numbers (larg numbers)
  if (result > 25000) {
    result = Rounding(result, 1000);
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] Rounding to multiples of $1000 %.2f\n", result);
  } else if (result > 2500) {
    result = Rounding(result, 100);
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] Rounding to multiples of $100 %.2f\n", result);
  } else if (result > 250) {
    result = Rounding(result, 10);
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] Rounding to multiples of $10 %.2f\n", result);
  } else if (result > 20) {
    result = Rounding(result, 1);
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] Rounding to multiples of $1 %.2f\n", result);
  }  
  // Whole numbers (small),
  // but only if we want to bet more than 0.90.
  // Avoid rounding to 0.
  else if ((result > 0.90) && (abs(result - int(result) < 0.10))) {
    result = Rounding(result, 1);
    write_log(preferences.debug_betsize_adjustment(),
      "[SwagAdjustment] Rounding a little bit to nearest $1 %.2f\n", result);
  }
  write_log(preferences.debug_betsize_adjustment(),
    "[SwagAdjustment] RoundToBeautifulBetsize: %.2f rounded to %.2f\n",
    amount_to_raise_to, result);
  assert(result > 0);
  return result;
}