Ejemplo n.º 1
0
        public void TestAgain()
        {
            DataHelpers.Entities.Fights.Load();
            HashSet <CutBase> doNothingCuts = new HashSet <CutBase>();
            var something = DataHelpers.Entities.Fights.Where(f => f.FightId >= 19 && !f.BadResult);

            foreach (Fight fight in something)
            {
                fight.SetCuts();
                FighterStats stats1 = new FighterStats(fight.Fighter1);
                FighterStats stats2 = new FighterStats(fight.Fighter2);
                foreach (Data.Round round in fight.Rounds)
                {
                    List <CutBase> cuts1 = FightHelpers.GetCutsForDataRound(round.First);
                    List <CutBase> cuts2 = FightHelpers.GetCutsForDataRound(round.Second);
                    CutPenalty     cp1   = CutBase.CalculatePenaltyForCuts(FightHelpers.GetCutsForDataRound(round.First));
                    CutPenalty     cp2   = CutBase.CalculatePenaltyForCuts(FightHelpers.GetCutsForDataRound(round.Second));
                    if (round.First.Tactic.Aggressiveness == 1)
                    {
                        continue;
                    }
                    if (FightHelpers.RoundMatchesExpectations(round, stats1, stats2, true, 0))
                    {
                        if (!cp1.HasNone || !cp2.HasNone)
                        {
                            Debug.Print("HMMM");
                        }
                        if (cuts1.Count > 0 || cuts2.Count > 0)
                        {
                            doNothingCuts.UnionWith(cuts1);
                            doNothingCuts.UnionWith(cuts2);
                        }
                    }
                    else
                    {
                        if (cp1.HasNone && cp2.HasNone)
                        {
                            Debug.Print("uh oh?");
                            if (FightHelpers.RoundMatchesExpectations(round, stats1, stats2, true, 0.1))

                            {
                                Debug.Print("Looks like, just a rounding thing");
                            }
                            else
                            {
                                Debug.Print("No it's worse");
                            }
                        }
                    }
                }
            }
            foreach (CutBase cb in doNothingCuts)
            {
                Debug.Print(cb.ToString() + " does nothing!");
            }
        }
Ejemplo n.º 2
0
        public string GetResult(CutBase film, CutBase list)
        {
            int widthDiv      = list.Width / film.Width;
            int wListhFilmDiv = list.Width / film.Height;
            int hListwFilmDiv = list.Height / film.Width;
            int heightDiv     = list.Height / film.Height;

            bool resultFlag = widthDiv * heightDiv > wListhFilmDiv * hListwFilmDiv;

            int count = (resultFlag)
                ? widthDiv * heightDiv
                : wListhFilmDiv * hListwFilmDiv;

            string orient = (resultFlag) ? "вдоль" : "поперёк";


            return((count > 0)
                ? $"Получится {count} шт. Располагать {orient}."
                : "Пленка слишком маленькая, попробуйте лист поменьше или пленку побольше :) ");
        }
Ejemplo n.º 3
0
 private void SetDefaultCut()
 {
     Resources.CutGroupPenaltyDictionary = CutBase.GetPenaltyDictionary();
     this.CutPenalties = Resources.CutGroupPenaltyDictionary.Select(s => s.Value).ToList();
 }