public TrickTracker GetPossibleScores(List <Card> cards, bool scopa) { TrickTracker tracker = new TrickTracker(this); tracker.TakeTrick(cards, scopa); return(tracker); }
private int CalculateWeight(AIScopaPlayer player, Card selectedCard, List <Card> selectedTrick, bool scopa) { // Make a decision here based on the number of denari as well as the primiera value // of the in the trick (also base this on player need. i.e. if the primiera value is above // the mid-range value (78) then we can prioritize denari and vise-versa for denari if the // player has more than 5 denari we can prioritize pirmiera. As a last criteria we pick up // as many cards as possible in each trick. List <Card> trick = new List <Card>(selectedTrick); trick.Add(selectedCard); TrickTracker tracker = player.GetPossibleScores(trick, scopa); int weight = ((!player.SetteBello && tracker.SetteBello) ? 84 : 0) + (scopa ? 84 : 0) + ((player.PrimieraValue > 78) ? 1 : 2) * (tracker.PrimieraValue - player.PrimieraValue) + ((player.DenariCount > 5) ? 1 : 2) * (tracker.DenariCount - player.DenariCount) + (tracker.CardCount - player.CardCount); Console.Out.WriteLine("SetteBello " + tracker.SetteBello + ", Scopa " + scopa); Console.Out.WriteLine("Primiera " + tracker.PrimieraValue + " <- " + player.PrimieraValue); Console.Out.WriteLine("Denari " + tracker.DenariCount + " <- " + player.DenariCount); Console.Out.WriteLine("Cards " + tracker.CardCount + " <- " + player.CardCount); Console.Out.WriteLine("Cards Taken " + Card.ToString(tracker.CardsTaken)); Console.Out.WriteLine("Trick " + Card.ToString(selectedTrick) + " with " + selectedCard + " := " + weight); return(weight); }
public AbstractScopaPlayer(string name, ScopaGame game) { this.game = game; this.name = name; hand = new List <Card>(); trickTracker = new TrickTracker(); points = 0; roundScore = 0; }
private TrickTracker(TrickTracker parent) { cardsTaken = new Dictionary <Suit, List <Card> >(); foreach (Suit suit in Enum.GetValues(typeof(Suit))) { cardsTaken.Add(suit, new List <Card> (parent.cardsTaken[suit])); } cardCount = parent.CardCount; primieraValue = parent.primieraValue; setteBello = parent.setteBello; scopaCount = parent.scopaCount; trickStack = new List <List <Card> >(); foreach (List <Card> trick in parent.trickStack) { trickStack.Add(new List <Card>(trick)); } }
public void NewRound() { hand.Clear(); trickTracker = new TrickTracker(); }