示例#1
0
文件: Node.cs 项目: vpechev/sixtysix
        private List <Card> AssignOppCards()
        {
            List <Card> opponentsCards = new List <Card>();

            CardsDeckUtil.ShuffleCards(CanBePlayedFromOpponent);
            List <Card> hasAnons = Opponent.HasTwentyForty;

            foreach (var card in hasAnons)
            {
                if (CanBePlayedFromOpponent != null &&
                    CanBePlayedFromOpponent.Count() != 0 &&
                    CanBePlayedFromOpponent.FirstOrDefault(x => x.Value == card.Value && x.Suit == card.Suit) != null)
                {
                    opponentsCards.Add(card);
                    CanBePlayedFromOpponent.Remove(card);
                }
            }

            while (opponentsCards.Count() < 6 && CanBePlayedFromOpponent.Count() > 0)
            {
                opponentsCards.Add(CanBePlayedFromOpponent.First());
                CanBePlayedFromOpponent.Remove(opponentsCards.First());
            }
            return(opponentsCards);
        }
示例#2
0
文件: Node.cs 项目: vpechev/sixtysix
        public void AddCard(List <Card> hand)
        {
            if (CanBePlayedFromOpponent.Count == 0)
            {
                return;
            }

            List <Card> tmp = CanBePlayedFromOpponent;

            foreach (var x in Parent.AlreadyUsedForChild)
            {
                tmp.Remove(x);
            }

            CardsDeckUtil.ShuffleCards(tmp);
            hand.Add(tmp.First());
            CanBePlayedFromOpponent.Remove(tmp.First());
        }