override public bool decideOnPlayer(CardDecision decision, RpsAgent otherPlayer) { Card opponentsCard = decisionToCard(decision); //Only accept requests we know we can win return(parentAI.IndexOfCardInHand(counterCard(opponentsCard)) != -1); }
override public bool decideOnPlayer(CardDecision decision, RpsAgent otherPlayer) { Card opponentsCard = decisionToCard(decision); Dictionary <Card, int> totalCardCounts = GameObject.FindObjectOfType <ChallengeLobbyManager>().getTotalCardCounts(); Card highestCardInPlay = totalCardCounts.Keys.Aggregate(Card.Rock, (x, y) => totalCardCounts[x] > totalCardCounts[y] ? x : y); if (parentAI.IndexOfCardInHand(counterCard(opponentsCard)) != -1) { return(highestCardInPlay == opponentsCard); } return(highestCardInPlay != opponentsCard); }
override public bool decideOnPlayer(CardDecision decision, RpsAgent otherPlayer) { Card opponentsCard = decisionToCard(decision); //Only accept requests which can leave our hand balanced Dictionary <Card, int> cardCounts = parentAI.getCardCounts(); if (parentAI.IndexOfCardInHand(counterCard(opponentsCard)) != -1) { return(cardCounts.Values.Aggregate(0, Mathf.Max) - cardCounts[counterCard(opponentsCard)] <= 1); } else if (parentAI.IndexOfCardInHand(opponentsCard) != -1) { return(cardCounts.Values.Aggregate(0, Mathf.Max) - cardCounts[opponentsCard] <= 1); } else { //If we can't beat the card, we'll challenge if our hand is sufficiently out of whack in terms of balance return(isProbable(decision) && (cardCounts.Values.Aggregate(0, Mathf.Max) - cardCounts.Values.Aggregate(cardCounts.Count, Mathf.Max)) > 1); } }
override public Card decideOnCard(CardDecision decision, RpsAgent otherPlayer) { Card opponentsCard = decisionToCard(decision); //The AI blindly decides to counter the player decision or match it if possible if (parentAI.IndexOfCardInHand(counterCard(opponentsCard)) != -1) { return(counterCard(opponentsCard)); } else { return(opponentsCard); } }