Example #1
0
def get_box(num_victory):
  """
  Input: the number of victory cards
  Returns: a dictionary of cards
  The number of "Gardens" is determined by the # of victory cards
  """
  box = {}
  box["Woodcutter"] = [Dominion.Woodcutter()] * 10
  box["Smithy"] = [Dominion.Smithy()] * 10
  box["Laboratory"] = [Dominion.Laboratory()] * 10
  box["Village"] = [Dominion.Village()] * 10
  box["Festival"] = [Dominion.Festival()] * 10
  box["Market"] = [Dominion.Market()] * 10
  box["Chancellor"] = [Dominion.Chancellor()] * 10
  box["Workshop"] = [Dominion.Workshop()] * 10
  box["Moneylender"] = [Dominion.Moneylender()] * 10
  box["Chapel"] = [Dominion.Chapel()] * 10
  box["Cellar"] = [Dominion.Cellar()] * 10
  box["Remodel"] = [Dominion.Remodel()] * 10
  box["Adventurer"] = [Dominion.Adventurer()] * 10
  box["Feast"] = [Dominion.Feast()] * 10
  box["Mine"] = [Dominion.Mine()] * 10
  box["Library"] = [Dominion.Library()] * 10
  box["Gardens"] = [Dominion.Gardens()] * num_victory
  box["Moat"] = [Dominion.Moat()] * 10
  box["Council Room"] = [Dominion.Council_Room()] * 10
  box["Witch"] = [Dominion.Witch()] * 10
  box["Bureaucrat"] = [Dominion.Bureaucrat()] * 10
  box["Militia"] = [Dominion.Militia()] * 10
  box["Spy"] = [Dominion.Spy()] * 10
  box["Thief"] = [Dominion.Thief()] * 10
  box["Throne Room"] = [Dominion.Throne_Room()] * 10
  return box
Example #2
0
def initBox(nV):
#Define box
    box = {}
    box["Woodcutter"]=[Dominion.Woodcutter()]*10
    box["Smithy"]=[Dominion.Smithy()]*10
    box["Laboratory"]=[Dominion.Laboratory()]*10
    box["Village"]=[Dominion.Village()]*10
    box["Festival"]=[Dominion.Festival()]*10
    box["Market"]=[Dominion.Market()]*10
    box["Chancellor"]=[Dominion.Chancellor()]*10
    box["Workshop"]=[Dominion.Workshop()]*10
    box["Moneylender"]=[Dominion.Moneylender()]*10
    box["Chapel"]=[Dominion.Chapel()]*10
    box["Cellar"]=[Dominion.Cellar()]*10
    box["Remodel"]=[Dominion.Remodel()]*10
    box["Adventurer"]=[Dominion.Adventurer()]*10
    box["Feast"]=[Dominion.Feast()]*10
    box["Mine"]=[Dominion.Mine()]*10
    box["Library"]=[Dominion.Library()]*10
    box["Gardens"]=[Dominion.Gardens()]*nV
    box["Moat"]=[Dominion.Moat()]*10
    box["Council Room"]=[Dominion.Council_Room()]*10
    box["Witch"]=[Dominion.Witch()]*10
    box["Bureaucrat"]=[Dominion.Bureaucrat()]*10
    box["Militia"]=[Dominion.Militia()]*10
    box["Spy"]=[Dominion.Spy()]*10
    box["Thief"]=[Dominion.Thief()]*10
    box["Throne Room"]=[Dominion.Throne_Room()]*10

    return box
Example #3
0
    def test_init(self):
        actionCard = Dominion.Woodcutter()

        self.assertEqual(actionCard.name, 'Woodcutter')
        self.assertEqual(actionCard.cost, 3)
        self.assertEqual(actionCard.actions, 0)
        self.assertEqual(actionCard.cards, 0)
        self.assertEqual(actionCard.buys, 1)
        self.assertEqual(actionCard.coins, 2)

        actionCard = Dominion.Village()

        self.assertEqual(actionCard.name, 'Village')
        self.assertEqual(actionCard.cost, 3)
        self.assertEqual(actionCard.actions, 2)
        self.assertEqual(actionCard.cards, 1)
        self.assertEqual(actionCard.buys, 0)
        self.assertEqual(actionCard.coins, 0)

        actionCard = FakeCard("TotallyFake", -100, -50, -100, -100, -100)

        self.assertEqual(actionCard.name, 'TotallyFake')
        self.assertEqual(actionCard.cost, -100)
        self.assertEqual(actionCard.actions, -50)
        self.assertEqual(actionCard.cards, -100)
        self.assertEqual(actionCard.buys, -100)
        self.assertEqual(actionCard.coins, -100)
Example #4
0
def get_boxes(nV):
    """
    :param nV: starting number of each victory card, used here
    for calculating number of garden cards
    :return: box, a dictionary containing starting lists of action cards
    """
    box = {}
    box["Woodcutter"] = [Dominion.Woodcutter()] * 10
    box["Smithy"] = [Dominion.Smithy()] * 10
    box["Laboratory"] = [Dominion.Laboratory()] * 10
    box["Village"] = [Dominion.Village()] * 10
    box["Festival"] = [Dominion.Festival()] * 10
    box["Market"] = [Dominion.Market()] * 10
    box["Chancellor"] = [Dominion.Chancellor()] * 10
    box["Workshop"] = [Dominion.Workshop()] * 10
    box["Moneylender"] = [Dominion.Moneylender()] * 10
    box["Chapel"] = [Dominion.Chapel()] * 10
    box["Cellar"] = [Dominion.Cellar()] * 10
    box["Remodel"] = [Dominion.Remodel()] * 10
    box["Adventurer"] = [Dominion.Adventurer()] * 10
    box["Feast"] = [Dominion.Feast()] * 10
    box["Mine"] = [Dominion.Mine()] * 10
    box["Library"] = [Dominion.Library()] * 10
    box["Gardens"] = [Dominion.Gardens()] * nV
    box["Moat"] = [Dominion.Moat()] * 10
    box["Council Room"] = [Dominion.Council_Room()] * 10
    box["Witch"] = [Dominion.Witch()] * 10
    box["Bureaucrat"] = [Dominion.Bureaucrat()] * 10
    box["Militia"] = [Dominion.Militia()] * 10
    box["Spy"] = [Dominion.Spy()] * 10
    box["Thief"] = [Dominion.Thief()] * 10
    box["Throne Room"] = [Dominion.Throne_Room()] * 10

    return box
Example #5
0
def define_box(nV):
    box = {}
    box["Woodcutter"]=[Dominion.Woodcutter()]*10
    box["Smithy"]=[Dominion.Smithy()]*10
    box["Laboratory"]=[Dominion.Laboratory()]*10
    box["Village"]=[Dominion.Village()]*10
    box["Festival"]=[Dominion.Festival()]*10
    box["Market"]=[Dominion.Market()]*10
    box["Chancellor"]=[Dominion.Chancellor()]*10
    box["Workshop"]=[Dominion.Workshop()]*10
    box["Moneylender"]=[Dominion.Moneylender()]*10
    box["Chapel"]=[Dominion.Chapel()]*10
    box["Cellar"]=[Dominion.Cellar()]*10
    box["Remodel"]=[Dominion.Remodel()]*10
    box["Adventurer"]=[Dominion.Adventurer()]*10
    box["Feast"]=[Dominion.Feast()]*10
    box["Mine"]=[Dominion.Mine()]*10
    box["Library"]=[Dominion.Library()]*10
    box["Gardens"]=[Dominion.Gardens()]*nV
    box["Moat"]=[Dominion.Moat()]*10
    box["Council Room"]=[Dominion.Council_Room()]*10
    box["Witch"]=[Dominion.Witch()]*10
    box["Bureaucrat"]=[Dominion.Bureaucrat()]*10
    box["Militia"]=[Dominion.Militia()]*10
    box["Spy"]=[Dominion.Spy()]*10
    box["Thief"]=[Dominion.Thief()]*10
    box["Throne Room"]=[Dominion.Throne_Room()]*10

    supply_order = {0: ['Curse', 'Copper'], 2: ['Estate', 'Cellar', 'Chapel', 'Moat'],
                    3: ['Silver', 'Chancellor', 'Village', 'Woodcutter', 'Workshop'],
                    4: ['Gardens', 'Bureaucrat', 'Feast', 'Militia', 'Moneylender', 'Remodel', 'Smithy', 'Spy', 'Thief',
                        'Throne Room'],
                    5: ['Duchy', 'Market', 'Council Room', 'Festival', 'Laboratory', 'Library', 'Mine', 'Witch'],
                    6: ['Gold', 'Adventurer'], 8: ['Province']}
    return box, supply_order
    def test_action_balance(self):
        self.setUp()

        # Create Village action card (actions prop = 2)
        self.player.deck = [Dominion.Village()]

        # Call the method
        test_balance = self.player.action_balance()

        # Test that balance (0 - 1 + 2 = 1 * 70 = 70)
        self.assertEqual(test_balance, 70)
Example #7
0
def getBoxes(nV):
    """
    Returns a box object
    takes nV as an argument that represents 
    the number of Victory Cards in play
    """

    #Create a box object
    box = {}
    box["Woodcutter"] = [Dominion.Woodcutter()] * 10
    box["Smithy"] = [Dominion.Smithy()] * 10
    box["Laboratory"] = [Dominion.Laboratory()] * 10
    box["Village"] = [Dominion.Village()] * 10
    box["Festival"] = [Dominion.Festival()] * 10
    box["Market"] = [Dominion.Market()] * 10
    box["Chancellor"] = [Dominion.Chancellor()] * 10
    box["Workshop"] = [Dominion.Workshop()] * 10
    box["Moneylender"] = [Dominion.Moneylender()] * 10
    box["Chapel"] = [Dominion.Chapel()] * 10
    box["Cellar"] = [Dominion.Cellar()] * 10
    box["Remodel"] = [Dominion.Remodel()] * 10
    box["Adventurer"] = [Dominion.Adventurer()] * 10
    box["Feast"] = [Dominion.Feast()] * 10
    box["Mine"] = [Dominion.Mine()] * 10
    box["Library"] = [Dominion.Library()] * 10
    box["Gardens"] = [Dominion.Gardens()] * nV
    box["Moat"] = [Dominion.Moat()] * 10
    box["Council Room"] = [Dominion.Council_Room()] * 10
    box["Witch"] = [Dominion.Witch()] * 10
    box["Bureaucrat"] = [Dominion.Bureaucrat()] * 10
    box["Militia"] = [Dominion.Militia()] * 10
    box["Spy"] = [Dominion.Spy()] * 10
    box["Thief"] = [Dominion.Thief()] * 10
    box["Throne Room"] = [Dominion.Throne_Room()] * 10

    return box
Example #8
0
#Get player names
player_names = ["Randy", "*Comp1", "*Comp2"]

#number of curses and victory cards
if len(player_names) > 2:
    nV = 12
else:
    nV = 8
nC = -10 + 10 * len(player_names)

#Define box
box = {}
box["Woodcutter"] = [Dominion.Woodcutter()] * 10
box["Smithy"] = [Dominion.Smithy()] * 10
box["Laboratory"] = [Dominion.Laboratory()] * 10
box["Village"] = [Dominion.Village()] * 10
box["Festival"] = [Dominion.Festival()] * 10
box["Market"] = [Dominion.Market()] * 10
box["Chancellor"] = [Dominion.Chancellor()] * 10
box["Workshop"] = [Dominion.Workshop()] * 10
box["Moneylender"] = [Dominion.Moneylender()] * 10
box["Chapel"] = [Dominion.Chapel()] * 10
box["Cellar"] = [Dominion.Cellar()] * 10
box["Remodel"] = [Dominion.Remodel()] * 10
box["Adventurer"] = [Dominion.Adventurer()] * 10
box["Feast"] = [Dominion.Feast()] * 10
box["Mine"] = [Dominion.Mine()] * 10
box["Library"] = [Dominion.Library()] * 10
box["Gardens"] = [Dominion.Gardens()] * nV
box["Moat"] = [Dominion.Moat()] * 10
box["Council Room"] = [Dominion.Council_Room()] * 10
Example #9
0
#Pick 10 cards from box to be in the supply.
boxlist = [k for k in box]
random.shuffle(boxlist)
random10 = boxlist[:10]
supply = defaultdict(list,[(k,box[k]) for k in random10])
supply = testUtility.GetSupply(player_names, supply, nV, nC)

#initialize the trash
trash = []

#Costruct the Player objects
players = testUtility.GetPlayers(player_names)


# Bug 2: Workshop behaves like a Village
box["Workshop"]=[Dominion.Village()]*10


#Play the game
turn  = 0
while not Dominion.gameover(supply):
    turn += 1
    print("\r")
    for value in supply_order:
        print (value)
        for stack in supply_order[value]:
            if stack in supply:
                print (stack, len(supply[stack]))
    print("\r")
    for player in players:
        print (player.name,player.calcpoints())
Example #10
0
# Get player names
player_names = testUtility.getPlayerNames()

# number of curses and victory cards
nV = testUtility.getnV(player_names)
nC = testUtility.getnC(player_names)

# Get box
box = testUtility.getBoxes(nV)

# TEST SCENARIO BUG 1 -- MIX UP THE CARDS
box["Smithy"] = [Dominion.Woodcutter()] * 10
box["Laboratory"] = [Dominion.Smithy()] * 10
box["Village"] = [Dominion.Laboratory()] * 10
box["Festival"] = [Dominion.Village()] * 10
box["Market"] = [Dominion.Festival()] * 10
box["Chancellor"] = [Dominion.Market()] * 10
box["Workshop"] = [Dominion.Chancellor()] * 10
box["Moneylender"] = [Dominion.Workshop()] * 10
box["Chapel"] = [Dominion.Moneylender()] * 10
box["Cellar"] = [Dominion.Chapel()] * 10
box["Remodel"] = [Dominion.Cellar()] * 10
box["Adventurer"] = [Dominion.Remodel()] * 10
box["Feast"] = [Dominion.Adventurer()] * 10
box["Mine"] = [Dominion.Feast()] * 10
box["Library"] = [Dominion.Mine()] * 10
box["Gardens"] = [Dominion.Library()] * 10
box["Moat"] = [Dominion.Gardens()] * nV
box["Council Room"] = [Dominion.Moat()] * 10
box["Witch"] = [Dominion.Council_Room()] * 10
Example #11
0
 def set_up(self):
     self.player = Dominion.Player('Thomas')
     self.action_card = Dominion.Village()
     self.trash = []