예제 #1
0
    // This CPU will play the stongest hand possible while NOT duplicating weapons
    public List <Card> playTournament(List <Player> players, List <Card> hand, int baseBP, int shields)
    {
        strategyUtil strat      = new strategyUtil();
        List <Card>  validCards = new List <Card>();

        for (int i = 0; i < hand.Count; i++)
        {
            var type = hand[i].type;
            if (type == "Ally Card" || type == "Weapon Card" || type == "Amour Card")
            {
                validCards.Add(hand[i]);
            }
        }

        validCards = strat.sortAllValidCardsByDescendingBP(validCards, players, "");
        List <Card> cardsToPlay = new List <Card>();

        for (int i = 0; i < validCards.Count; i++)
        {
            if (strat.checkDuplicate(validCards[i], cardsToPlay, "Weapon Card"))
            {
                cardsToPlay.Add(validCards[i]);
                hand.Remove(validCards[i]);
            }
        }
        return(cardsToPlay);
    }
예제 #2
0
    // We play the fewest cards possible to get to 50 or our best possible total
    public List <Card> playTournament(List <Player> players, List <Card> hand, int baseBP, int shields)
    {
        strategyUtil strat = new strategyUtil();
        // Generate a list of valid cards --> weapon, ally, and amour
        List <Card> validCards = new List <Card>();

        for (var i = 0; i < hand.Count; i++)
        {
            var type = hand[i].type;
            if (type == "Ally Card" || type == "Weapon Card" || type == "Amour Card")
            {
                validCards.Add(hand[i]);
            }
        }
        validCards = strat.sortAllValidCardsByDescendingBP(validCards, players, "");
        // get how much BP we need left by subtracting our base
        int bpNeeded = 50 - baseBP;

        // instantiate the list of cards were returning to play
        List <Card> cardsToPlay = new List <Card>();

        // index = 0, because were trying to move through the validCards one at a time
        int index = 0;

        // until either we run out of validCards or we have gone above the BP threshold we wish to hit (50)
        while (bpNeeded > 0 && index < validCards.Count)
        {
            // first make sure that we still have cards in validCards to evaluate
            // check that the card were trying to play isn't a duplicate weapon
            if (strat.checkDuplicate(validCards[index], cardsToPlay, "Weapon Card"))
            {
                // add the card to our cards to be played
                bpNeeded -= strat.getValidCardBP(validCards[index], players, "");
                cardsToPlay.Add(validCards[index]);
                hand.Remove(validCards[index]);
            }
            index++;
        }
        return(cardsToPlay);
    }