Example #1
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 #2
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 #3
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 #4
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
Example #5
0
 def test_add_festival(self):
     #print("totalbuypower test_add_festival...")
     #print(players[0].hand)
     bp1 = Dominion.totalbuypower(players[0].hand)
     #print(bp1)
     supply["Festival"] = [Dominion.Festival()] * 1
     players[0].hand.append(supply['Festival'][0])
     #print(players[0].hand)
     bp2 = Dominion.totalbuypower(players[0].hand)
     #print(bp2)
     self.assertEqual(bp1 + 2, bp2)
Example #6
0
    def test_gameover(self):
        supply = {}
        supply['Province'] = [Dominion.Province()] * 10
        supply['Market'] = [Dominion.Market()] * 10
        supply['Gold'] = [Dominion.Gold()] * 10
        supply['Festival'] = [Dominion.Festival()] * 10

        # gameover should return false
        self.assertFalse(Dominion.gameover(supply))

        # gameover should return true
        supply['Province'] = [Dominion.Province()] * 0
        self.assertTrue(Dominion.gameover(supply))

        # gameover should return false
        supply['Province'] = [Dominion.Province()] * 1
        supply['Market'] = [Dominion.Market()] * 0
        supply['Gold'] = [Dominion.Gold()] * 0
        self.assertFalse(Dominion.gameover(supply))

        # gameover should return true
        supply['Festival'] = [Dominion.Festival()] * 0
        self.assertTrue(Dominion.gameover(supply))
Example #7
0
    def test_action_balance(self):
        # set up and instantiate action card
        self.set_up()
        self.player.balance = self.player.action_balance()

        # player begins with no action card, so value should return 0
        self.assertEqual(0, self.player.balance)

        # instantiate an action card and add to player stack
        action_card = Dominion.Festival()
        self.player.deck.append(action_card)

        # call action_balance should return a value not equal to 0
        self.player.balance = self.player.action_balance()
        self.assertIsNot(0, self.player.balance)
Example #8
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 #9
0
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
box["Witch"] = [Dominion.Witch()] * 10
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
box["Bureaucrat"] = [Dominion.Witch()] * 10