예제 #1
0
파일: AI.cs 프로젝트: marcus1337/Spades
        private Card getLowestPlayableCard(Spades spades)
        {
            List <Card> playableCards = spades.getPlayableCards(playerIndex);
            Card        lowest        = playableCards[0];

            foreach (Card card in playableCards)
            {
                if (!spades.isOtherCardBetter(lowest, card))
                {
                    lowest = card;
                }
            }
            return(lowest);
        }
예제 #2
0
파일: AI.cs 프로젝트: marcus1337/Spades
        private bool canWinTrick(Spades spades)
        {
            Card leadCard = spades.getBestPlayedCard();

            if (leadCard == null)
            {
                return(true);
            }
            List <Card> playableCards = spades.getPlayableCards(playerIndex);

            foreach (Card card in playableCards)
            {
                if (spades.isOtherCardBetter(leadCard, card))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #3
0
파일: AI.cs 프로젝트: marcus1337/Spades
        private List <Card> getWinnableCards(Spades spades)
        {
            Card leadCard = spades.getBestPlayedCard();

            if (leadCard == null)
            {
                return(spades.getPlayableCards(playerIndex));
            }

            List <Card> winCards      = new List <Card>();
            List <Card> playableCards = spades.getPlayableCards(playerIndex);

            foreach (Card card in playableCards)
            {
                if (spades.isOtherCardBetter(leadCard, card))
                {
                    winCards.Add(card);
                }
            }
            return(winCards);
        }