예제 #1
0
        public decimal GetTotalFantasyPoints()
        {
            decimal?points = PublisherGames
                             .Sum(x => x.FantasyPoints);

            return(points ?? 0m);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public bool HasRemainingGameSpot(int totalSpots)
        {
            if (totalSpots > PublisherGames.Count(x => !x.CounterPick))
            {
                return(true);
            }

            return(false);
        }
예제 #4
0
        public int GetAvailableSlots(LeagueOptions options, bool yearFinished)
        {
            if (yearFinished)
            {
                return(0);
            }

            return(options.StandardGames - PublisherGames.Count(x => !x.CounterPick));
        }
예제 #5
0
    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);
    }
예제 #6
0
    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);
    }
예제 #7
0
    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);
    }
예제 #8
0
 public void AcquireGame(PublisherGame game, uint bidAmount)
 {
     PublisherGames = PublisherGames.Concat(new [] { game }).ToList();
     Budget        -= bidAmount;
 }
예제 #9
0
 public Maybe <PublisherGame> GetPublisherGame(MasterGame masterGame)
 {
     return(PublisherGames.SingleOrDefault(x => x.MasterGame.HasValue && x.MasterGame.Value.MasterGame.MasterGameID == masterGame.MasterGameID));
 }
예제 #10
0
 public decimal GetProjectedFantasyPoints(ScoringSystem scoringSystem, LeagueWideValues leagueWideValues)
 {
     return(PublisherGames.Sum(x => x.GetProjectedFantasyPoints(scoringSystem, leagueWideValues)));
 }
예제 #11
0
 public PublisherGame?GetPublisherGameByPublisherGameID(Guid publisherGameID)
 {
     return(PublisherGames.SingleOrDefault(x => x.PublisherGameID == publisherGameID));
 }