nicolafan / pyleague-soccer-simulation

A Python soccer championship simulation
MIT License
5 stars 3 forks source link

Generate random minutes of the goals #6

Closed nicolafan closed 2 years ago

nicolafan commented 2 years ago

Once the result of a game has been simulated (i.e. 2-3, 3-3, 1-1) it will be necessary to simulate the minutes (1-90) in which the goals have been scored. I think this could be completely random, without any weight; a simple line of thought would be:
1) select one of the two teams; 2) for each goal scored by this team, generate a random number in the discrete interval {1, ..., 90}; 3) for the next goal of this team, generate a random number in the same interval, after removing the minute of the previous goal from the interval (we'll make the simplifying assumption that two goals have to be scored in different minutes); 4) repeat this process for all the goals of the first team. After that we'll do the same thing for the away team, but we'll start with an interval which already does not contain the minutes of the goals scored by the home team.

This function should be implemented in the simulation.py module.

We can assume to have two input parameters: goals_h: number of goals of the home team : int, goals_a: number of goals of the away team: int.

The function should return two ordered lists: the minutes of the goals of the home team, the minutes of the goals of the away team.

yahayaohinoyi commented 2 years ago

I created a pr on this