根据技能水平确定获胜百分比
我正在制作一个程序,其中两个玩家在“战斗”中面对面,每个玩家都有一个技能水平,用 1 到 100 之间的数字表示,这个数字用于确定哪个玩家更好,例如如果玩家 A 有50,玩家 B 有 100,那么 B 赢得战斗的机会多 50%,有什么办法可以让这个数字了解双方玩家的技能水平呢?
我尝试了不同的方法,例如添加两个技能级别并在该范围内选择一个随机数,如果该数字小于玩家技能,那么他获胜,但是我不确定这是否是一个好方法,我认为概率是离开。我还尝试使用规则,例如,如果他们具有相同的技能,则为 50%(任何人都可以获胜),如果一个是另一个的一半,则较低玩家的机会为 25%,依此类推,但这很快就会变得复杂。有关如何进行此计算的任何指示?
预先感谢您的帮助
-hei
I am making a program in which two players face each other in "combat", each player have a skill level, represented by a number between 1 and 100, this number is used to determine which player is better so for example if player A has 50 and player B has 100 then B has 50% more chances of winning the combat, What would be a good way of getting this number knowing the skill level of both players?
I tried different ways, for example adding both skill levels and throwing a selecting a random number in this range if the number is less than a player skill then he wins however i am not sure if this is a good way, I think the probability is off. I also tried to use rules, for example if they have the same skill then is 50% (anyone can win) if one is half the other then is 25% chances for the lower player and so on but this gets complicated fast. Any pointers on how to do this calculation?
Thank you in advance for your help
-hei
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的意思是玩家 B 获胜的次数应该是玩家 B 的两倍,那么这是有效的:
获胜者 A 将赢得 50/150 或 1/3时间。获胜者 B 将赢得 2/3 的时间(两倍)。
也许你的意思是距离就是重量。例如,10 比 5 应该有 5% 的优势。
那么你可以尝试(假设
B >= A
):所以如果
A == B
那么机会是偶数。If you mean that player B should win twice as often, then this works:
Winner A will win 50/150 or 1/3 of the time. Winner B will win 2/3 of the time (twice as much).
Maybe you mean for the distance to be the weight. E.g., 10 vs 5 should have a 5% advantage.
Then you could try (assuming
B >= A
):So if
A == B
then chances are even.