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
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
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
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): player = Dominion.Player('Annie') # base deck has nothing to balance, expect 0 self.assertEqual(0, player.action_balance()) # add one action card to change the balance variable, which will change return value to non-zero player.deck = [Dominion.Copper()] * 7 + [Dominion.Estate() ] * 3 + [Dominion.Thief()] * 1 self.assertIsNot(0, player.action_balance())
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
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'],
from collections import defaultdict import testUtility # Get player names player_names = testUtility.getPlayerNames() # number of curses and victory cards nV = testUtility.getNumVictoryCards(player_names) nC = testUtility.getNumCurses(player_names) # Define box box = testUtility.defineBox(nV) # DATA BUG: swapping Throne Room and Thief cards box["Thief"]=[Dominion.Throne_Room()]*10 box["Throne Room"]=[Dominion.Thief()]*10 # initialize supply_order supply_order = testUtility.getSupplyOrder() # Pick 10 cards from box to be in the supply. supply = testUtility.pickBoxCards(box) # The supply always has these cards. testUtility.addStandardSupplyCards(supply, supply_order, nV, nC) # Construct the Player objects players = testUtility.makePlayers(player_names) # Play the game testUtility.playGame(supply, supply_order, players)
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'] } # Define what cards will be in the supply for this game supply = testUtility.supplyInit(box, nV, nC, len(player_names)) # Initialize the trash trash = [] # Set up test data supply["Thief"] += [Dominion.Thief()] * 10 # Construct the player objects players = testUtility.playerInit(player_names) # Play the game testUtility.play(supply, supply_order, players, trash) # Print winners testUtility.finalize(players)