public decimal GetTotalFantasyPoints() { decimal?points = PublisherGames .Sum(x => x.FantasyPoints); return(points ?? 0m); }
public decimal GetProjectedFantasyPoints(LeagueOptions options, SystemWideValues systemWideValues, bool yearFinished, bool simpleProjections, IClock clock) { var currentGamesScore = PublisherGames.Sum(x => x.GetProjectedOrRealFantasyPoints(options.ScoringSystem, systemWideValues, simpleProjections, clock)); var availableSlots = GetAvailableSlots(options, yearFinished); var emptySlotsScore = availableSlots * systemWideValues.AverageStandardGamePoints; return(currentGamesScore + emptySlotsScore); }
public bool HasRemainingGameSpot(int totalSpots) { if (totalSpots > PublisherGames.Count(x => !x.CounterPick)) { return(true); } return(false); }
public int GetAvailableSlots(LeagueOptions options, bool yearFinished) { if (yearFinished) { return(0); } return(options.StandardGames - PublisherGames.Count(x => !x.CounterPick)); }
public decimal GetTotalFantasyPoints(SupportedYear year, LeagueOptions leagueOptions) { var emptyCounterPickSlotPoints = GetEmptyCounterPickSlotPoints(year, leagueOptions) ?? 0m; var score = PublisherGames.Sum(x => x.FantasyPoints); if (!score.HasValue) { return(emptyCounterPickSlotPoints); } return(score.Value + emptyCounterPickSlotPoints); }
private decimal?GetEmptyCounterPickSlotPoints(SupportedYear year, LeagueOptions leagueOptions) { if (!SupportedYear.Year2022FeatureSupported(year.Year)) { return(0m); } if (!year.Finished) { return(null); } var expectedNumberOfCounterPicks = leagueOptions.CounterPicks; var numberCounterPicks = PublisherGames.Count(x => x.CounterPick); var emptySlots = expectedNumberOfCounterPicks - numberCounterPicks; var points = emptySlots * -15m; return(points); }
public IReadOnlyList <PublisherSlot> GetPublisherSlots(LeagueOptions leagueOptions) { List <PublisherSlot> publisherSlots = new List <PublisherSlot>(); int overallSlotNumber = 0; var standardGamesBySlot = PublisherGames.Where(x => !x.CounterPick).ToDictionary(x => x.SlotNumber); for (int standardGameIndex = 0; standardGameIndex < leagueOptions.StandardGames; standardGameIndex++) { PublisherGame?standardGame = null; if (standardGamesBySlot.TryGetValue(standardGameIndex, out var foundGame)) { standardGame = foundGame; } SpecialGameSlot?specialSlot = leagueOptions.GetSpecialGameSlotByOverallSlotNumber(standardGameIndex); publisherSlots.Add(new PublisherSlot(standardGameIndex, overallSlotNumber, false, specialSlot, standardGame)); overallSlotNumber++; } var counterPicksBySlot = PublisherGames.Where(x => x.CounterPick).ToDictionary(x => x.SlotNumber); for (int counterPickIndex = 0; counterPickIndex < leagueOptions.CounterPicks; counterPickIndex++) { PublisherGame?counterPick = null; if (counterPicksBySlot.TryGetValue(counterPickIndex, out var foundGame)) { counterPick = foundGame; } publisherSlots.Add(new PublisherSlot(counterPickIndex, overallSlotNumber, true, null, counterPick)); overallSlotNumber++; } return(publisherSlots); }
public void AcquireGame(PublisherGame game, uint bidAmount) { PublisherGames = PublisherGames.Concat(new [] { game }).ToList(); Budget -= bidAmount; }
public Maybe <PublisherGame> GetPublisherGame(MasterGame masterGame) { return(PublisherGames.SingleOrDefault(x => x.MasterGame.HasValue && x.MasterGame.Value.MasterGame.MasterGameID == masterGame.MasterGameID)); }
public decimal GetProjectedFantasyPoints(ScoringSystem scoringSystem, LeagueWideValues leagueWideValues) { return(PublisherGames.Sum(x => x.GetProjectedFantasyPoints(scoringSystem, leagueWideValues))); }
public PublisherGame?GetPublisherGameByPublisherGameID(Guid publisherGameID) { return(PublisherGames.SingleOrDefault(x => x.PublisherGameID == publisherGameID)); }