private static int[] Simulate(string firstTeamName, int fixturesNumber) { int firstTeamWinRate = 0; int firstTeamDrawRate = 0; int iterationsNumber = fixturesNumber < 5 ? 1 : 2; for (int i = 0; i <= iterationsNumber; i++) { int goalsDiff = SimulateTeamScore() - SimulateTeamScore(); firstTeamWinRate += GoalsHelper.GetWinRate(true, goalsDiff); firstTeamDrawRate += GoalsHelper.GetDrawRate(true, goalsDiff); } return(new int[4] { firstTeamWinRate / iterationsNumber, firstTeamDrawRate / iterationsNumber, 100 - (firstTeamWinRate / iterationsNumber), 100 - (firstTeamDrawRate / iterationsNumber) }); }
private static int[] CalculateByGoals(string firstTeamName, IList <Fixture> fixtures) { int firstTeamWinRate = 0; int firstTeamDrawRate = 0; foreach (var fixture in fixtures) { bool playsAthome = fixture.Team_season_home_name.Contains(firstTeamName); int goalsDiff = playsAthome ? fixture.Number_goal_team_home - fixture.Number_goal_team_away : fixture.Number_goal_team_away - fixture.Number_goal_team_home; firstTeamWinRate += GoalsHelper.GetWinRate(playsAthome, goalsDiff); firstTeamDrawRate += GoalsHelper.GetDrawRate(playsAthome, goalsDiff); } return(new int[4] { firstTeamWinRate / fixtures.Count, firstTeamDrawRate / fixtures.Count, 100 - (firstTeamWinRate / fixtures.Count), 100 - (firstTeamDrawRate / fixtures.Count) }); }