def setUp(self): # Get player names self.player_names = testUtility.getPlayerNames() # number of curses and victory cards self.nV = testUtility.getnV(self.player_names) self.nC = testUtility.getnC(self.player_names) # Get box self.box = testUtility.getBoxes(self.nV) # Get supply order self.supply_order = testUtility.getSupplyOrder() # Pick 10 cards from box to be in the supply. self.boxlist = testUtility.getBoxList(self.box) self.random10 = testUtility.getRandom10(self.boxlist) self.supply = testUtility.getSupply(self.box, self.random10) # The supply always has these cards self.supply = testUtility.getDefaultSupply(self.supply, self.player_names, self.nV, self.nC) # initialize the trash self.trash = [] # Construct the Player objects self.players = testUtility.getPlayers(self.player_names) # Instantiate player self.player = Dominion.Player('Annie')
def main(): #Get player names player_names = ["Annie", "*Ben", "*Carla"] # Number of curses and victory cards if len(player_names) > 2: nV = 12 else: nV = 8 nC = -10 + 10 * len(player_names) # Costruct the Player objects players = testUtility.createPlayers(player_names) # Create the box box = testUtility.getBoxes(nV) # Establish supply with 10 cards supply = testUtility.establishSupply(box, nC, nV, player_names) # Play Dominion testUtility.play(supply, players) # Show final score testUtility.finalScore(players)
def set_up(self): self.player_names = testUtility.getPlayers() self.nV = testUtility.getVictoryCards(self.player_names) self.nC = testUtility.getCurseCards(self.player_names) self.box = testUtility.getBoxes(self.nV) self.supply = testUtility.getSupply(self.nV, self.nC, self.player_names, self.box)
def test_gameover(self): supply = testUtility.establishSupply(testUtility.getBoxes(1), 1, 1, ['Annie', 'Bob']) # test case that end of function reached; returns False self.assertFalse(Dominion.gameover(supply)) # test case to remove Province card, so first if branch returns True supply["Province"].pop() self.assertTrue(Dominion.gameover(supply)) # test case to force the out variable to increase above 3, which returns True supply = testUtility.establishSupply(testUtility.getBoxes(1), 1, 1, ['Annie', 'Bob']) for stack in supply: supply[stack] = [] self.assertTrue(Dominion.gameover(supply))
def setUp(self): self.player_name = testUtility.getPlayerNames() self.nC = testUtility.getNumberCurse(self.player_name) self.nV = testUtility.getNumberVictory(self.player_name) self.box = testUtility.getBoxes(self.nV) self.supply_order = testUtility.getSupplyOrder() # pick cards from box to be in supply self.supply = testUtility.getSupply(self.box, self.player_name, self.nV, self.nC) self.trash = [] self.player = Dominion.Player('Annie')
def setUp(self): #Data Setup self.player_names = ["Annie","*Ben","*Carla"] self.players = testUtility.getPlayers(self.player_names) self.nV = testUtility.numVic(self.players) self.nC = testUtility.getCurses(self.players) self.box = testUtility.getBoxes(self.nV) self.supply_order = testUtility.getSupplyOrder() self.supply = testUtility.getSupply(self.box) testUtility.setSupply(self.supply, self.players, self.nV, self.nC) self.trash = [] self.player = Dominion.Player('Annie')
def setUp(self): # Data setup # Get player names self.player_names = testUtility.getPlayerNames() # number of curses and victory cards self.nV = testUtility.getNumberOfVictoryCards(self.player_names) self.nC = testUtility.getNumberOfCurseCards(self.player_names) # Define box self.box = testUtility.getBoxes(self.nV) self.supply_order = testUtility.getSupplyOrder() # Pick 10 random cards from box to be in the supply, then add the cards that are included in every game. self.supply = testUtility.getSupplyCards(self.box, self.player_names, self.nV, self.nC) # initialize the trash self.trash = testUtility.initializeTrash()
""" import Dominion import random import testUtility from collections import defaultdict #Get player names player_names = ["Annie", "*Ben", "*Carla"] #number of curses and victory cards nV = testUtility.numVic(player_names) nC = -10 + 10 * len(player_names) #define box box = testUtility.getBoxes(nV) 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']