private static AnimalContestItem PickTheWinner(AnimalContestItem animalContestInfo, List <AnimalContestItem> history, FarmAnimal farmAnimal, string thirdContender)
        {
            if (farmAnimal != null)
            {
                int friendshipPoints   = farmAnimal.friendshipTowardFarmer.Value / 195;
                int monthsOld          = (farmAnimal.age.Value + 1) / 28 + 1;
                int agePoints          = monthsOld < 4 ? monthsOld : Math.Max(0, 5 - (monthsOld + 1) / 2);
                int treatVarietyPoints = Math.Min(3, farmAnimal.GetFeedTreatsQuantityCount());
                int weeksOld           = (farmAnimal.age.Value + 1) / 7 + 1;
                int treatAveragePoints = Math.Min(3, (farmAnimal.GetFeedTreatsQuantitySum() * 3) / weeksOld);
                int parentWinnerPoints = history.Exists(h => h.Winner == "Farmer" && h.ParticipantId == farmAnimal.parentId.Value) ? 1 : 0;

                animalContestInfo.FarmAnimalScore = new AnimalContestScore(friendshipPoints, monthsOld, agePoints, treatVarietyPoints, treatAveragePoints, parentWinnerPoints);
                int totalPoints = animalContestInfo.FarmAnimalScore.TotalPoints;
                if (
                    (totalPoints >= DataLoader.AnimalContestData.MinPointsToGaranteeWin) ||
                    (totalPoints >= DataLoader.AnimalContestData.MinPointsToPossibleWin &&
                     agePoints > 0 && ((treatVarietyPoints > 0 && treatAveragePoints > 0) || DataLoader.ModConfig.DisableTreats) && friendshipPoints > 0 &&
                     history.Count(h => h.Winner != "Farmer") >= history.Count(h => h.Winner == "Farmer"))
                    )
                {
                    animalContestInfo.Winner = "Farmer";
                    return(animalContestInfo);
                }
            }
            if (history.Exists(h => h.Contenders.Contains(thirdContender)) && history.Count(h => h.Winner == "Marnie") > history.Count(h => h.Winner == thirdContender))
            {
                animalContestInfo.Winner = thirdContender;
            }
            else
            {
                animalContestInfo.Winner = "Marnie";
            }
            return(animalContestInfo);
        }