我的兄弟在几周内满21岁,而我和我的父母将他带到拉斯维加斯。在我21岁的时候,我带着200美元在拉斯维加斯赌博并带着大约450美元回家,大部分来自于掷骰子。我计划再次为这次旅行带来200美元,在我走之前,我想我会做一些掷骰子模拟,看看我能不能再把钱翻倍。
我从几个消息来源中读到,当以最大赔率投注副注金时,房子在掷骰子方面的优势最小。从我的记忆中,以及Wizard of Odds的调查,大道上的大多数赌场都是3-4-5赔率,最低5美元。考虑到这一点,这里是在PHP中模拟掷骰子会话(100个骰子卷):
<?php
$stash = 200;
$bet = 5;
for($i=100; $i--;) {
$dice1 = mt_rand(1, 6);
$dice2 = mt_rand(1, 6);
$total = $dice1 + $dice2;
if(!$button) {
if($total===7 || $total===11) {
$stash += $bet;
}
elseif($total===2 || $total===3 || $total===12) {
$stash -= $bet;
}
else {
$button = $total;
if($total===4 || $total===10) {
$odds = $bet*3;
}
elseif($total===5 || $total===9) {
$odds = $bet*4;
}
elseif($total===6 || $total===8) {
$odds = $bet*5;
}
}
}
else {
if($total===7) {
$button = 0;
$stash -= ($bet + $odds);
}
elseif($total===$button) {
$button = 0;
$stash += $bet;
if($total===4 || $total===10) {
$stash += $odds*2/1;
}
elseif($total===5 || $total===9) {
$stash += $odds*3/2;
}
elseif($total===6 || $total===8) {
$stash += $odds*6/5;
}
}
}
echo 'Stash: $'.$stash.'<br/>';
}
?>
我的数学在这里有什么问题吗?虽然每次会话都有高峰和低谷,但这种模拟往往会在破产之前将其资金翻倍。考虑到房子总是有骰子的边缘,即使它只是一个百分之几,我对这个结果感到困惑。
答案 0 :(得分:9)
我会小心处理任何用于“证明”的代码,在你破产之前,你更有可能在掷骰子(或任何其他机会游戏)中加倍你的钱。拉斯维加斯是内华达州沙漠中一个庞大的城市,作为两件事的证明:
任何赌场都没有任何游戏可以放在他们的地板上而不会同时利用这两个规则。如果你的代码不同意拉斯维加斯,我会把钱投入拉斯维加斯。
<强>更新强>
这是我根据您的原始代码编写的一些C ++。您发布的原始问题是,如果您在经常破产之前可以将资金翻倍。我跟着我写的代码跟进了一些结果。
#include <iostream>
int die_roll()
{
return std::rand() % 6 + 1;
}
int win_count_g(0);
int loss_count_g(0);
// return true when double our money.
// return false when we can't bet anymore.
bool test_loop(int cash)
{
static const int bet_k(5);
int goal(cash * 2);
int button(0);
while (true)
{
if (cash >= goal)
return true;
else if (cash < bet_k)
return false;
int roll(die_roll() + die_roll());
int odds(0); // additional odds bet
if (button == 0)
{
if (roll == 7 || roll == 11)
{
++win_count_g;
cash += bet_k;
}
else if (roll == 2 || roll == 3 || roll == 12)
{
++loss_count_g;
cash -= bet_k;
}
else
{
button = roll;
if (roll == 4 || roll == 10)
{
odds = std::min(cash - bet_k, bet_k * 3);
}
else if (roll == 5 || roll == 9)
{
odds = std::min(cash - bet_k, bet_k * 4);
}
else // if (roll == 6 || roll == 8)
{
odds = std::min(cash - bet_k, bet_k * 5);
}
}
}
else
{
if (roll == 7)
{
++loss_count_g;
button = 0;
cash -= bet_k + odds;
}
else if (roll == button)
{
++win_count_g;
button = 0;
cash += bet_k;
if (roll == 4 || roll == 10)
{
cash += odds * 2;
}
else if (roll == 5 || roll == 9)
{
cash += odds * 3 / 2;
}
else // if (roll == 6 || roll == 8)
{
cash += odds * 6 / 5;
}
}
}
}
}
void test(int cash)
{
win_count_g = 0;
loss_count_g = 0;
int doubled(0);
int broke(0);
for (int i(0); i < 10000; ++i)
if (test_loop(cash))
++doubled;
else
++broke;
float win_percentage(static_cast<float>(doubled) / (doubled + broke) * 100.0);
std::cout << "starting cash: $" << cash
<< "; doubled: " << doubled
<< "; broke: " << broke
<< " (" << win_percentage << "% win)"
<< "; loop wins: " << win_count_g
<< "; loop losses: " << loss_count_g
<< std::endl;
}
int main ()
{
static const int cash_set_k[] =
{
5,
10,
20,
50,
100,
200,
400,
800,
1000
};
static const int cash_set_size_k(sizeof(cash_set_k) / sizeof(cash_set_k[0]));
std::for_each(&cash_set_k[0], &cash_set_k[cash_set_size_k], &test);
return 0;
}
结果:
starting cash: $5; doubled: 4944; broke: 5056 (49.44% win); loop wins: 4944; loop losses: 5056
starting cash: $10; doubled: 4862; broke: 5138 (48.62% win); loop wins: 19706; loop losses: 20258
starting cash: $20; doubled: 4755; broke: 5245 (47.55% win); loop wins: 78360; loop losses: 80320
starting cash: $50; doubled: 4345; broke: 5655 (43.45% win); loop wins: 489406; loop losses: 502506
starting cash: $100; doubled: 3553; broke: 6447 (35.53% win); loop wins: 1914393; loop losses: 1972273
starting cash: $200; doubled: 2468; broke: 7532 (24.68% win); loop wins: 7172464; loop losses: 7375024
starting cash: $400; doubled: 861; broke: 9139 (8.61% win); loop wins: 22615369; loop losses: 23277609
starting cash: $800; doubled: 112; broke: 9888 (1.12% win); loop wins: 54556881; loop losses: 56121041
starting cash: $1000; doubled: 31; broke: 9969 (0.31% win); loop wins: 69308617; loop losses: 71296217
答案 1 :(得分:5)
好吧,马上,我可以看到你在简单的7或11胜利案例中遇到错误:你应该赢得你的赌注,而不是你赌注的两倍。
编辑:我相信赔率的支付与实际概率相称。你输7分(输掉赔率)的几率是10的两倍,所以当你以4或10获胜时,你应该以2:1获得奖金;当你以6或8获胜时,只支付6:5。
答案 2 :(得分:4)
你没有检查你的藏匿物是否有足够的空间来放置你想要的赔率。事实上,你根本没有检查藏匿的大小。毫不奇怪,即使您的藏匿处大小为负,如果您能够下注,此模拟将能够更频繁地击败该房屋。
顺便说一下,我对你的100个骰子投掷进行了50,000次迭代(我修改了剩余的最大赌注)并提出了以下内容:
胜利:23807 损失:25465推(你带200美元离开):728
平均。奖金:$ 109.07