public static ExpectedScore CalculateExpectedScore( TablePlacing homeTeam, TablePlacing awayTeam, double homeConstant, double awayConstant) { var expectedHomeGoals = homeConstant * homeTeam.AttackingStrength * awayTeam.DefensiveWeakness; var expectedAwayGoals = awayConstant * awayTeam.AttackingStrength * homeTeam.DefensiveWeakness; return(new ExpectedScore(expectedHomeGoals, expectedAwayGoals)); }
private static ISimulatableMatch CreateMatch( bool resim, Season seasonSoFar, TablePlacing homeTeam, TablePlacing awayTeam, double homeConstant, double awayConstant) { if (!resim) { var pastMatch = seasonSoFar.Matches.SingleOrDefault(m => m.HomeTeamName == homeTeam.TeamName && m.AwayTeamName == awayTeam.TeamName); if (pastMatch != null) { return(SimulatableMatch.CreateFromCompletedMatch(pastMatch)); } } var expectedScore = Calculator.CalculateExpectedScore(homeTeam, awayTeam, homeConstant, awayConstant); return(SimulatableMatch.CreateFromExpectedScore(homeTeam.TeamName, awayTeam.TeamName, expectedScore)); }