Ejemplo n.º 1
0
        public void ConclusionGetState_CasseAllCardsTransfered()
        {
            Karta transfer0 = ObsugaKart.StwórzKarte(Karta.Dama, Karta.karo);
            Karta transfer2 = ObsugaKart.StwórzKarte(Karta.Król, Karta.karo);
            ConclusionAboutGame conclusionAboutGame = new ConclusionAboutGame(3, 1, Date.simpleCards8);

            conclusionAboutGame.TransferedCard(transfer0, 0);
            conclusionAboutGame.TransferedCard(transfer2, 2);
            conclusionAboutGame.MoveContext = MoveContext1000.ChoseCards;
            var             tmp         = conclusionAboutGame.GetStates();
            int             AmountCards = 0;
            HashSet <Karta> usedcards   = new HashSet <Karta>();

            foreach (var item in tmp.cards.SelectMany(X => X))
            {
                AmountCards++;
                if (usedcards.Contains(item))
                {
                    throw new NotImplementedException("jakaś karta się powtaża");
                }
                usedcards.Add(item);
            }
            Assert.AreEqual(AmountCards, 24);
            Assert.IsTrue(tmp.cards[0].Any(X => X == transfer0));
            Assert.IsTrue(tmp.cards[2].Any(X => X == transfer2));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// aplikacja słóży do optymalizacji pod wzgledem wydajności
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            ConclusionAboutGame cm = new ConclusionAboutGame(3, 1, Date.simpleCards8);

            cm.TransferedCard(ObsugaKart.StwórzKarte(Karta.Dama, Karta.kier), 0);
            cm.TransferedCard(ObsugaKart.StwórzKarte(Karta.Król, Karta.kier), 2);
            cm.MoveContext = MoveContext1000.ChoseCards;
            var a = IQ1000Game.GetIqState(cm.GetStates());
        }
Ejemplo n.º 3
0
        public void ConclusionGetState_CasseRestryction()
        {
            ConclusionAboutGame conclusionAboutGame = new ConclusionAboutGame(3, 1, Date.simpleCards8);

            conclusionAboutGame.PlayerConclusion[0].TheMostFigureInColor[0] = Karta.K2;
            conclusionAboutGame.PlayerConclusion[2].TheMostFigureInColor[3] = Karta.K2;
            conclusionAboutGame.MoveContext = MoveContext1000.ChoseCards;
            var tmp = conclusionAboutGame.GetStates();

            Assert.IsFalse(tmp.cards[0].Any(X => ObsugaKart.Kolor(X) == Karta.trelf));
            Assert.IsFalse(tmp.cards[2].Any(X => ObsugaKart.Kolor(X) == Karta.pik));
        }
Ejemplo n.º 4
0
        public void UsingIq()
        {
            ConclusionAboutGame cm = new ConclusionAboutGame(3, 1, Date.simpleCards8);

            cm.TransferedCard(ObsugaKart.StwórzKarte(Karta.Dama, Karta.kier), 0);
            cm.TransferedCard(ObsugaKart.StwórzKarte(Karta.Król, Karta.kier), 2);
            cm.MoveContext = MoveContext1000.ChoseCards;
            var a           = IQ1000Game.GetIqState(cm.GetStates());
            int Sum         = a.Item2.scoreInCurentGame.Sum();
            int AmountCards = a.Item2.cards.Sum(X => X.Count);

            Assert.IsTrue(Sum >= 120);
            Assert.AreEqual(0, AmountCards);
        }
Ejemplo n.º 5
0
        public void ConclusionGetState_CasseAllCards()
        {
            ConclusionAboutGame conclusionAboutGame = new ConclusionAboutGame(3, 1, Date.simpleCards);
            var             tmp         = conclusionAboutGame.GetStates();
            int             AmountCards = 0;
            HashSet <Karta> usedcards   = new HashSet <Karta>();

            foreach (var item in tmp.cards.SelectMany(X => X))
            {
                AmountCards++;
                if (usedcards.Contains(item))
                {
                    throw new NotImplementedException("jakaś karta się powtaża");
                }
                usedcards.Add(item);
            }
            Assert.AreEqual(AmountCards, 24);
        }