【发布时间】:2018-01-18 19:48:57
【问题描述】:
我想知道这个模拟器是否能正常工作,因为我不认为这些是合乎逻辑的答案,但也无法捕捉到错误。
我已经为以下游戏编写了一个模拟器(给定一副牌和 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
模拟显示了选择要玩的每张 MAX 卡的获胜系数。它显示了这些让我非常怀疑的数字。我预计它会增长到 1.5 到 7 然后再回到 1。
(先胜/模拟次数,第二最大发牌员可以让你继续游戏)
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);
}
}
}
}
【问题讨论】:
-
那么问题或问题是什么?
-
抱歉忘记加了,想知道这个模拟器好不好用
-
你的意思是“pick”(你选择卡片的地方)还是“draw”(随机分配的地方)?
-
我的意思是你随机抽卡,你不知道你得到了什么。
标签: c# algorithm statistics simulation probability