gpt4 book ai didi

c - 调整风险规则会对游戏产生什么影响?

转载 作者:行者123 更新时间:2023-11-30 15:47:33 24 4
gpt4 key购买 nike

我在这里发布此链接是为了链接到 RPG.stackexchange.

我正在运行一款探路者游戏,该游戏将有大量军队相互对抗。我看到的加快速度的建议之一是使用《Risk》棋盘游戏的规则。

但是风险规则假设单位具有相同的值(value)。如果将一支军队的骰子从 d6 更改为 d8 会发生什么?

Answerssimilar questions ,虽然经过深思熟虑,但不要让自己陷入“如果”问题,而规则会有细微的变化。我怀疑数学家们是否会欣赏这种纠缠。

(另外,如果您没有扎实掌握统计学,那么尝试学习 R 编程会有点困难。这并不像知道 R 语法就能告诉您如何拟合线性模型。)

所以,stackoverflow,给我找一个 Risk(棋盘游戏)模拟器,我可以摆弄规则集,直到我对它的计算感到满意为止。

最佳答案

是的,先生,当然,先生,马上,先生。

//Experimenting with Risk variant
//Because figuring out the actual mathmatics behind this is hard.

#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))

//#define DISTRUSTRAND 1
//#define VERBOSE 1


int g_rollArray[100];

int compare (const void * a, const void * b)
{
return ( *(int*)b - *(int*)a );
}



int diceRoll(int dieSize)
{
int roll = rand()%(dieSize-1);
g_rollArray[roll]++;
return roll+1;
}


// MAIN!
int main( int argc, char* args[] )
{
int seed;
int maxRound=100000; //Some arbitrarily large number.
int round=0;
int i;

memset(g_rollArray,0,sizeof(int)*100);

//Hmmm, there could be a mix of troops, but right now, let's say it's uniform.
const int numAtt = 3; //How many troops they bring into the fight, that's how many dice they roll
const int powAtt = 8; //The size of the dice they roll. Like d4, d6, d8.
int rollAtt[numAtt];

const int numDef = 2; //How many troops they bring into the fight, that's how many dice they roll
const int powDef = 6; //The size of the dice they roll. Like d4, d6, d8.
int rollDef[numDef];

int lossAtt=0; //Assuming a big-ass pool of troops behind them. Whoever runs out of a pool first loses.
int lossDef=0;


seed = time(0);
srand(time(0));
printf("seed: %d\n",seed);

#ifdef DISTRUSTRAND
for(i=0; i<10; i++)
{
printf("%d: %d\n",i, rollArray[i]);
}
#endif

for(round=0; round<maxRound; round++)
{
for(i=0; i<numAtt; i++)
{
rollAtt[i] = diceRoll(powAtt);
}
for(i=0; i<numDef; i++)
{
rollDef[i] = diceRoll(powDef);
}

qsort (rollAtt, numAtt, sizeof(int), compare);
qsort (rollDef, numDef, sizeof(int), compare);

#ifdef VERBOSE
printf("sort Att: ");
for(i=0; i<numAtt; i++)
{
printf("%d ",rollAtt[i]);
}
printf("\n");

printf("sort Def: ");
for(i=0; i<numDef; i++)
{
printf("%d ",rollDef[i]);
}
printf("\n");
#endif


//The MIN here decrees that armies can only lose the forces they commit to a fight
for(i=0; i<MIN(numDef,numAtt); i++)
{
#ifdef VERBOSE
printf("Comp: %d Vs %d \n",rollAtt[i], rollDef[i]);
#endif
//Defenders win ties
if(rollAtt[i] > rollDef[i])
{
lossDef++;
}
else
{
lossAtt++;
}
}
}


printf("Att losses: %d \n",lossAtt);
printf("Def losses: %d \n",lossDef);

if(lossAtt > lossDef)
{
printf("Odds to win: Defender \nKill ratio: %f\n", (float)lossAtt/(float)lossDef);
}
else
{
printf("Odds to win: Attacker \nKill ratio: %f\n", (float)lossDef/(float)lossAtt);
}

#ifdef DISTRUSTRAND
for(i=0; i<10; i++)
{
printf("%d: %d\n",i, rollArray[i]);
}
#endif
return 0;
}


/* meh, unneeded, mingw's rand()%whatnot works well enough.
int betterRand(int n)
{
return rand() / (RAND_MAX / n + 1);
}

float betterFRand(float n)
{
return (float)rand()/((float)RAND_MAX/n);
}
*/

虽然最初的风险规则集只给攻击者带来了大约 8% 的优势,相当于大约 1:1.06 的击杀率,但事实证明,如果改变骰子大小,胜算就会很快改变。给攻击者 d8,他们的杀伤率为 1:3。也就是说,一支 throw 数为 1-8 的军队击败一支只 throw 数为 1-6 但其规模是其规模 3 倍的军队的几率是偶数。

如果你保持军队之间的骰子大小相等,但增加它,随着平局影响的减弱,胜算会稍微向攻击者倾斜

增加骰子数量比增加骰子尺寸有更微妙的影响。拥有 3 d6 的防守者比拥有 2 d8 的攻击者稍好。

总而言之,对于任何想要玩弄风险规则并看看结果是什么的 DM 来说,这是一个很好的起点。

希望一旦我了解了 R,我就能通过图表和其他东西得到更好的答案。

关于c - 调整风险规则会对游戏产生什么影响?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17331262/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com