Example #1
0
def run(two_dice: bool) -> pd.DataFrame:
    """
    Run the full analysis on all cards.
    """
    # The factory cards depend on the other cards in your hand.
    # Analyze using one of each kind of card they depend on.
    hand = [cards.WheatField(), cards.Ranch(), cards.Forest()]
    return pd.DataFrame({
        "Card": [card.name for card in cards.distinct_cards],
        "Expected coins per roll (2p)": [
            gross_expected_value(card, hand, two_dice, num_players=2)
            for card in cards.distinct_cards
        ],
        "Expected coins per roll (3p)": [
            gross_expected_value(card, hand, two_dice, num_players=3)
            for card in cards.distinct_cards
        ],
        "Expected coins per roll (4p)": [
            gross_expected_value(card, hand, two_dice, num_players=4)
            for card in cards.distinct_cards
        ],
        "Minimum rolls for payoff (4p)": [
            fastest_payoff(card, hand, num_players=4)
            for card in cards.distinct_cards
        ],
        "Expected rolls for payoff (4p)": [
            expected_payoff(card, hand, two_dice, num_players=4)
            for card in cards.distinct_cards
        ]
    })
def highest_margin():
    return Strategy(
        buy=_from_build_order([
            cards.Ranch(),
            cards.WheatField(),
            cards.Ranch(),
            cards.Ranch(),
            cards.Stadium(),
            cards.WheatField(),
            cards.Ranch(),
            cards.WheatField(),
            cards.RadioTower(),
            cards.WheatField(),
            cards.ShoppingMall(),
            cards.TrainStation(),
            cards.AmusementPark(),
        ]),
        roll_two=roll_two_never)
def big_convenience_store():
    return Strategy(
        buy=_from_build_order([
            cards.WheatField(),
            cards.Ranch(),
            cards.Ranch(),
            cards.ConvenienceStore(),
            cards.ConvenienceStore(),
            cards.Ranch(),
            cards.ConvenienceStore(),
            cards.Forest(),
            cards.Bakery(),
            cards.ShoppingMall(),
            cards.ConvenienceStore(),
            cards.RadioTower(),
            cards.TrainStation(),
            cards.AmusementPark(),
        ]),
        roll_two=roll_two_never)
def buy_everything():
    return Strategy(
        buy=_from_build_order([
            cards.WheatField(),
            cards.Ranch(),
            cards.Bakery(),
            cards.Cafe(),
            cards.ConvenienceStore(),
            cards.Forest(),
            cards.Stadium(),
            # cards.TvStation(),
            # cards.BusinessCenter(),
            cards.CheeseFactory(),
            cards.FurnitureFactory(),
            cards.AppleOrchard(),
            cards.TrainStation(),
            cards.Mine(),
            cards.FruitVegetableMarket(),
            cards.ShoppingMall(),
            cards.Mine(),
            cards.AmusementPark(),
            cards.RadioTower()
        ]),
        roll_two=roll_two_always_after_train_station)
 def __init__(self, num_players: int):
     # This is what each player gets for the start of the game.
     self.hand = [cards.WheatField(), cards.Bakery()]
     self.coins = 3
     self.num_players = num_players