Calculate winner of soccer match

303 Views Asked by At

I am writing a program that simulates a soccer tournament between countries using their FIFA rankings. I am looking for a function that takes two country rankings and outputs a number between (about) 0 and 3 (the margin by which the winning team wins) such that the number is likelier to be higher if the difference in ranks is larger and incorporates a random number function (returns a number between 0 and 1). I am currently using $$(\mbox{random }x \in [0,1]) \times \frac{\mbox{max}(\mbox{1st team's rank},\mbox{2nd team's rank})}{\mbox{min}(\mbox{1st team's rank},\mbox{2nd team's rank})} + 3 \times (\mbox{random }x \in [0,1])$$ The program gives the lower ranked team this plus some random base points and the higher ranked team just the base points unless the above (rounded down) is 0, in which case the higher ranked team wins by some random number. Does anyone know a better/cooler margin function?

1

There are 1 best solutions below

1
On

If you had the teams' win-loss percentages, then you could say that for two teams, the probability that each team wins is proportional to their winning percentage (so if two teams have the same record, then it's 50/50, etc.). This doesn't handle the number of goals the winning team wins by though (which can be 0, resulting in a tie). For that, you can sample a sigmoid function that starts at 0 and ends at 3, and is parametrized e.g. by a multiple of the ratio of the two teams' winning percentages (where you add 1 to both teams' wins so that you don't divide by 0).

If you don't have the teams' win-loss records, then this is somewhat an ill-posed problem because e.g. you don't know how good the top team is (maybe they were undefeated, or maybe they had close to a 50/50 record, etc.)