我想知道这个模拟器是否可以正常工作,因为我不认为这些是合乎逻辑的答案,但也不能捕捉到错误。加倍游戏模拟
我写了一个模拟器随后的比赛(鉴于一副扑克牌和1分)找到最优策略(什么是经销商最大的牌继续游戏)
1. Dealer picks a card and shows it to you(Dealer can't pick Joker)
2. You decide whether to play or no
3.1. If you don't play you get current points and finish game
3.2. If you play you pick a Card
3.2.1. If your card is higher you get double points and go back to step 1
3.2.2. If your and dealer's cards are equal you go back to step 1
3.2.3. If dealer's card is higher you lose all points and finish
仿真结果表明赢系数以显示这些数字,这对我来说是非常可疑的。我预计它会增长到1.5到7,然后回到1.
(First-Win/number of simulations,Second-最大牌经销商可以为你继续游戏)
1 -1
1.0853817 0
1.1872532 1
1.3126581 2
1.4672619 3
1.6704736 4
1.9485809 5
2.2674231 6
2.9993735 7
3.5692085 8
4.3581477 9
4.0109722 10
2.3629856 11
0 12
这里的C#代码:
using System;
namespace Codeforces
{
class Program
{
static int[] k = new int[54];
static Random rand = new Random();
static long Doubling(int i, long f)
{
int d = rand.Next(52);
if (k[d] > i) return f;
int ch = d;
while (ch == d) ch = rand.Next(54);
if (k[d] > k[ch]) return 0;
if (k[d] == k[ch]) return Doubling(i, f);
return Doubling(i, f * 2);
}
static void Main(string[] args)
{
for (int i = 0; i < 54; i++) k[i] = i/4;
for (int i = -1; i < 13; i++)
{
long sum = 0;
for (int j = 0; j < 1e7; j++)
{
sum += Doubling(i, 1);
}
Console.WriteLine(sum/1.0e7 + " " + i);
}
}
}
}
那么最新的问题或问题? –
对不起忘了补充,我想知道这个模拟器是否正常工作 – luka25
您的意思是“挑选”(您选择卡的地方)还是“绘制”(随机分配的地方)? –