Improving soccer simulation algorithm

后端 未结 4 490
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 07:00

In another question, you helped me to build a simulation algorithm for soccer. I got some very good answers there. Thanks again!

Now I\'ve coded this algorithm. I would

4条回答
  •  醉酒成梦
    2021-01-31 07:27

    I (quickly) read through it and I noticed a couple of things:

    • The percentage a red / yellow card is handed out is the same in all thirds of the field, is this intentional? I'm not a soccer guy, but I'd say that offences are more likely to happen on the last third of the field, than on the first. (Because if you're on the first, you're likely defending)

    • The percentage to determine that a penalty is scored is the same for each team, however some teams, or rather players, are more likely to score a penalty than others.

    • You're not taking into account corner kicks, possible injuries after a foul, or goals scored using the head (which might be worth mentioning in the report).

    Apart from that, you'll just need to run this simulation a lot of times and see if the values you chose are correct; tweak the algorithm. The best thing to do is hand tweak it (eg. read all the constants from a file and run a couple of hundred simulations with different values and different teams), the easiest thing to do is probably to implement a Genetic Algorithm to try and find better values.

    Basically what you have here is genuine gameplay / ai code, so you might want to read up on techniques used by game studios to manage this type of code. (One thing is to put the variables in a google spreadsheet which you can then share / tweak more easily, for example).

    Also, even though you're missing some things that a real soccer match has, there's no point trying to be as realistic as possible because generally in these cases it's more important to provide nice gameplay than it is to provide an accurate simulation.

提交回复
热议问题