Ejemplo n.º 1
0
 public MyPlayerAction(string strategyName, Card withCard, GameStatePredicate withCardPurchaseCondition)
     : base(strategyName,
            purchaseOrder: PurchaseOrder(withCard, withCardPurchaseCondition),
            treasurePlayOrder: DefaultStrategies.DefaultTreasurePlayOrder(),
            actionOrder: ActionOrder(withCard))
 {
 }
Ejemplo n.º 2
0
            private static CardPickByPriority PurchaseOrder(Card withCard, GameStatePredicate withCardPurchaseCondition)
            {
                return new CardPickByPriority(
                    CardAcceptance.For(Cards.Province),

                    CardAcceptance.For(Cards.Rebuild, gameState =>
                        CountAllOwned(Cards.Rebuild, gameState) < 2),

                    //In non-mirrors, get a 3rd Rebuild
                    CardAcceptance.For(Cards.Rebuild, gameState =>
                        CountAllOwned(Cards.Rebuild, gameState) < 3 &&
                        CountOfPile(Cards.Rebuild, gameState) > 7),

                    CardAcceptance.For(Cards.Duchy),

                    CardAcceptance.For(Cards.Estate, gameState => CountOfPile(Cards.Province, gameState) <= 1),

                    CardAcceptance.For(Cards.Estate, gameState =>
                        CountOfPile(Cards.Province, gameState) == 2 &&
                        PlayersPointLead(gameState) > -8),

                    CardAcceptance.For(Cards.Gold),

                    CardAcceptance.For(Cards.Estate, gameState => CountOfPile(Cards.Province, gameState) <= 2),

                    CardAcceptance.For(Cards.Rebuild, gameState =>
                        (CountAllOwned(Cards.Duchy, gameState) > 0 || PlayersPointLead(gameState) > 2) &&
                        (CountOfPile(Cards.Rebuild, gameState) > 2 ||
                        PlayersPointLead(gameState) > 3 ||
                        (CountOfPile(Cards.Rebuild, gameState) == 1 && PlayersPointLead(gameState) > 0))),

                    CardAcceptance.For(Cards.Estate, gameState =>
                        CountOfPile(Cards.Duchy, gameState) >= 4 &&
                        CountAllOwned(Cards.Duchy, gameState) == 0 &&
                        CountAllOwned(Cards.Estate, gameState) == 0),

                    CardAcceptance.For(Cards.Estate, gameState =>
                        CountOfPile(Cards.Duchy, gameState) == 0 &&
                        CountAllOwned(Cards.Duchy, gameState) == 0),

                    new CardAcceptance(withCard, withCardPurchaseCondition),

                    CardAcceptance.For(Cards.Silver));
            }
Ejemplo n.º 3
0
        private static CardPickByPriority PurchaseOrder(Card withCard, GameStatePredicate withCardPurchaseCondition)
        {
            return(new CardPickByPriority(
                       CardAcceptance.For(Cards.Province),

                       CardAcceptance.For(Cards.Rebuild, gameState =>
                                          CountAllOwned(Cards.Rebuild, gameState) < 2),

                       //In non-mirrors, get a 3rd Rebuild
                       CardAcceptance.For(Cards.Rebuild, gameState =>
                                          CountAllOwned(Cards.Rebuild, gameState) < 3 &&
                                          CountOfPile(Cards.Rebuild, gameState) > 7),

                       CardAcceptance.For(Cards.Duchy),

                       CardAcceptance.For(Cards.Estate, gameState => CountOfPile(Cards.Province, gameState) <= 1),

                       CardAcceptance.For(Cards.Estate, gameState =>
                                          CountOfPile(Cards.Province, gameState) == 2 &&
                                          PlayersPointLead(gameState) > -8),

                       CardAcceptance.For(Cards.Gold),

                       CardAcceptance.For(Cards.Estate, gameState => CountOfPile(Cards.Province, gameState) <= 2),

                       CardAcceptance.For(Cards.Rebuild, gameState =>
                                          (CountAllOwned(Cards.Duchy, gameState) > 0 || PlayersPointLead(gameState) > 2) &&
                                          (CountOfPile(Cards.Rebuild, gameState) > 2 ||
                                           PlayersPointLead(gameState) > 3 ||
                                           (CountOfPile(Cards.Rebuild, gameState) == 1 && PlayersPointLead(gameState) > 0))),

                       CardAcceptance.For(Cards.Estate, gameState =>
                                          CountOfPile(Cards.Duchy, gameState) >= 4 &&
                                          CountAllOwned(Cards.Duchy, gameState) == 0 &&
                                          CountAllOwned(Cards.Estate, gameState) == 0),

                       CardAcceptance.For(Cards.Estate, gameState =>
                                          CountOfPile(Cards.Duchy, gameState) == 0 &&
                                          CountAllOwned(Cards.Duchy, gameState) == 0),

                       new CardAcceptance(withCard, withCardPurchaseCondition),

                       CardAcceptance.For(Cards.Silver)));
        }
Ejemplo n.º 4
0
 public CardAcceptance(Card card, GameStatePredicate match)
 {
     this.card = card;
     this.match = match;
     this.overpayAmount = OverPayZero;
 }
Ejemplo n.º 5
0
 public CardAcceptance(Card card)
 {
     this.card = card;
     this.match = AlwaysMatch;
     this.overpayAmount = OverPayZero;
 }
Ejemplo n.º 6
0
 public MyPlayerAction(int playerNumber, string strategyName, Card withCard, GameStatePredicate withCardPurchaseCondition)
     : base(strategyName,
         playerNumber,
         purchaseOrder: PurchaseOrder(withCard, withCardPurchaseCondition),
         treasurePlayOrder: Default.DefaultTreasurePlayOrder(),
         actionOrder: ActionOrder(withCard))
 {
 }
Ejemplo n.º 7
0
        public static CardAcceptance For(Card card, CountSource countSource, Comparison comparison, int threshhold, GameStatePredicate match)
        {
            MatchDescription descr = new MatchDescription(card, countSource, comparison, threshhold);

            return CardAcceptance.For(card, gameState => descr.GameStatePredicate(gameState) && match(gameState));
        }
Ejemplo n.º 8
0
 public static CardAcceptance For(Card card, GameStatePredicate match, GameStateIntValue overpayAmount)
 {
     return new CardAcceptance(card, match, overpayAmount);
 }
Ejemplo n.º 9
0
 public static CardAcceptance For(Card card, GameStatePredicate match)
 {
     return(new CardAcceptance(card, match));
 }
Ejemplo n.º 10
0
 public CardAcceptance(Card card, GameStatePredicate match, GameStateIntValue overpayAmount)
 {
     this.card          = card;
     this.match         = match;
     this.overpayAmount = overpayAmount;
 }
Ejemplo n.º 11
0
 public CardAcceptance(Card card, GameStatePredicate match)
 {
     this.card          = card;
     this.match         = match;
     this.overpayAmount = DefaultOverpayAmount;
 }
Ejemplo n.º 12
0
 public CardAcceptance(Card card)
 {
     this.card          = card;
     this.match         = DefaultMatch;
     this.overpayAmount = DefaultOverpayAmount;
 }
Ejemplo n.º 13
0
 public CardAcceptance(Card card, GameStatePredicate match)
 {
     this.card = card;
     this.match = match;
     this.overpayAmount = DefaultOverpayAmount;
 }
Ejemplo n.º 14
0
 public CardAcceptance(Card card)
 {
     this.card = card;
     this.match = DefaultMatch;
     this.overpayAmount = DefaultOverpayAmount;
 }
 public CardPickForCondition(GameStatePredicate predicate, ICardPicker picker)
 {
     this.picker = picker;
     this.predicate = predicate;
 }
Ejemplo n.º 16
0
 public CardAcceptance(Card card, GameStatePredicate match, GameStateIntValue overpayAmount)
 {
     this.card = card;
     this.match = match;
     this.overpayAmount = overpayAmount;
 }
Ejemplo n.º 17
0
 public static CardAcceptance For(Card card, GameStatePredicate match)
 {
     return new CardAcceptance(card, match);
 }
Ejemplo n.º 18
0
 public static CardAcceptance For(Card card, GameStatePredicate match, GameStateIntValue overpayAmount)
 {
     return(new CardAcceptance(card, match, overpayAmount));
 }
Ejemplo n.º 19
0
 public static CardAcceptance For(Card card, int threshhold, GameStatePredicate match)
 {
     return For(card, CountSource.AllOwned, Comparison.LessThan, threshhold, match);
 }
Ejemplo n.º 20
0
 public static CardAcceptance For(Card card, int threshhold, GameStatePredicate match)
 {
     return(For(card, CountSource.AllOwned, Comparison.LessThan, threshhold, match));
 }
Ejemplo n.º 21
0
 public CardPickForCondition(GameStatePredicate predicate, ICardPicker picker)
 {
     this.picker    = picker;
     this.predicate = predicate;
 }
Ejemplo n.º 22
0
        public static CardAcceptance For(Card card, CountSource countSource, Comparison comparison, int threshhold, GameStatePredicate match)
        {
            MatchDescription descr = new MatchDescription(card, countSource, comparison, threshhold);

            return(CardAcceptance.For(card, gameState => descr.GameStatePredicate(gameState) && match(gameState)));
        }