什么是根据球队实力生成足球比分的好方法?

huangapple go评论65阅读模式
英文:

What's a good way of generating football scores based on team strength?

问题

大约一年前,我尝试制作一个简单的基于文本的足球模拟程序,但我放弃了,现在我想从头开始,因为它实际效果并不好。我的问题在于找到一个用于计算比分的好算法。

我不希望这个程序只是一个混乱的Math.random()函数堆砌,而是希望结合Math.random()和球队实力(每个球队都被赋予了1-20的进攻和防守评分,但这也可以改进,因为我不确定这是否是最优的方法)来计算比分,也许还可以加入主场优势和状态/士气的因素(但这会稍后考虑,因为它更加复杂)。

在我之前的程序中,算法会比较两支球队的进攻和防守评分,然后决定随机产生多少个进球。例如,如果一支球队的最高进攻评分为20,在与防守评分为5的球队比赛时,他们很可能会进几个球。但是,这个算法存在一些问题:

  1. 我认为很难通过这个算法加入主场优势和状态因素。算法中充斥着大量的if和else,以及一个1到100之间的随机整数,用于产生不同的胜率。
  2. 尽管我给较弱的球队有机会进几个球,但并没有太多出人意料的比赛结果。
  3. 比分太离谱,球队一周接一周地以5-1获胜。
  4. 从技术上讲,它并没有实际检查一支球队是否在整体上更好,只是根据进攻和防守来决定球队会进多少球。因此在理论上,进攻可能会过于强大(虽然我可能错了)。
  5. 假设一支必须赢得联赛的球队正在与一支已经获得中游名次的球队比赛:这不会对比赛产生影响。我认为这可能是要和状态一起添加的内容,但我不确定。

考虑到这些问题,您是否有一个更好的算法想法?我不懂机器学习之类的东西,我希望这个程序相对简单。当然,我并不需要您为我编写整个算法,只需给我一些一般性的思路。非常感谢 什么是根据球队实力生成足球比分的好方法?

英文:

About a year ago I tried to make a simple text-based football simulation program but I abandoned it and I want to start from the beginning since it wasn't really good. My problem is finding a good algorithm for calculating the scores.

I don't want this program to just be a big Math.random() mess, but instead, use a combination of Math.random() and team strength (each team was given attack and defense ratings of 1-20, but that could be improved too since I'm not sure if that's the optimal way of doing it) in order to calculate the scores, and maybe throw home advantage and form/morale into the mix (but that would be later since it's slightly more complicated).

In my previous program, the algorithm compared the attack and defense ratings of the 2 teams and then decided how many goals to randomize. So for example, if a team had a max of 20 attack rating and played against a team with 5 defence rating, they would most likely score a few goals. A few problems with this algorithm are:

  1. I think will be really hard to incorporate home advantage and form using this algorithm. It was a lot of if's and else's with a random integer between 1 to 100 to have different chance percentages.
  2. There were not a lot of surprise results, despite the fact that I gave smaller teams a chance to score a few goals.
  3. The scores were insane, with teams winning 5-1 week in, week out.
  4. It didn't technically check if a team is better overall, just decided the number of goals a team would score based on attack vs defense. So theoretically, attack could be overpowered (I might be wrong though).
  5. Let's say a team who has to win the league and they are playing against a team who already secured a mid-table finish: that wouldn't have had an effect on the game. I suppose this is something to add next to form but I don't know.

Considering these points, do you have a good idea for a better algorithm? I don't know machine learning and all that stuff, I want this program to be somewhat simple. I also don't need you to write the whole algorithm for me of course, just give me some general ideas. Thanks a lot 什么是根据球队实力生成足球比分的好方法?

答案1

得分: 0

我的建议(只是在胡思乱想,我对足球比分模拟一无所知)。

我会为每支球队分配一个相对的“进球潜力”,意思是“这支球队平均会进多少球”(针对所有球队的整体数据)。然后模拟将基于正态分布,其均值等于两支球队进球潜力之差,还有一定的标准偏差。

为了获得适当的值,你可以获取一些球队的历史数据,计算他们的平均进球数(每场比赛),以及全局标准偏差。

你可以通过为不同的球队分配不同的标准偏差来完善模型,这将反映出他们的“稳定性”。同样,你可以根据实际数据计算这些值,以获得现实的估值(并检查使用不同值是否有任何意义)。

主场优势可以被建模为进球潜力的固定增量。你也可以通过计算一支给定球队在主场和客场比赛时的平均进球数,然后取两者之差来衡量实际的主场优势(这是一种判断主场优势是否真实存在的方式)。

英文:

My suggestion (just thinking out loud, I have no experience at all on football scores simulation).

I would assign every team a relative "goal potential", meaning like "how many goals would that team score on average" (against the whole population of teams). Then the simulation would be based on a normal distribution with the mean equal to the difference of goal potentials of the two players, and a some standard deviation.

To get an idea of appropriate values, you could take historical data of a few teams and compute their average number of goals (per match played), and the global standard deviation.

You could refine the model by assigning the teams different standard deviations, which will reflect their "regularity". Again you can compute these on actual data to get an idea of realistic values (and check if using different values makes any sense).

The home advantage can be modelled as just a fixed increment of the goal potential. You can also measure actual home advantage by computing the two average goal-per-match of a given team, both when home or visitor, and taking the difference (this is a way to see if home advantage is real or just folklore).

huangapple
  • 本文由 发表于 2020年9月24日 17:16:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/64043308.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定