def setUp(self): # Get player names # player_names = ["Annie","*Ben","*Carla"] self.player_names = testUtility.GetPlayers() # number of curses and victory cards if len(self.player_names) > 2: self.nV = 12 else: self.nV = 8 self.nC = -10 + 10 * len(self.player_names) # Refactored Get boxs self.box = testUtility.GetBoxes(self.nV) # refactored supplu order self.supply_order = testUtility.SupplyOrder() # Pick 10 cards from box to be in the supply. self.supply = defaultdict(list) # The supply always has these cards self.supply["Copper"] = [Dominion.Copper()] self.supply["Silver"] = [Dominion.Silver()] self.supply["Gold"] = [Dominion.Gold()] self.supply["Estate"] = [Dominion.Estate()] self.supply["Duchy"] = [Dominion.Duchy()] self.supply["Province"] = [Dominion.Province()] self.supply["Curse"] = [Dominion.Curse()] # initialize the trash self.trash = [] self.player = Dominion.Player('Annie')
def setUp(self): self.player_names = testUtility.GetPlayers() # number of curses and victory cards if len(self.player_names) > 2: self.nV = 12 else: self.nV = 8 self.nC = -10 + 10 * len(self.player_names) # Refactored Get boxs self.box = testUtility.GetBoxes(self.nV) # refactored supplu order self.supply_order = testUtility.SupplyOrder() # Pick 10 cards from box to be in the supply. self.boxlist = [k for k in self.box] random.shuffle(self.boxlist) self.random10 = self.boxlist[:10] self.supply = defaultdict(list, [(k, self.box[k]) for k in self.random10]) # The supply always has these cards self.supply["Copper"] = [Dominion.Copper() ] * (60 - len(self.player_names) * 7) self.supply["Silver"] = [Dominion.Silver()] * 40 self.supply["Gold"] = [Dominion.Gold()] * 30 self.supply["Estate"] = [Dominion.Estate()] * self.nV self.supply["Duchy"] = [Dominion.Duchy()] * self.nV self.supply["Province"] = [Dominion.Province()] * self.nV self.supply["Curse"] = [Dominion.Curse()] * self.nC # initialize the trash self.trash = [] self.name = "Blueberry" self.actions = 3 self.coins = 10 self.player = Dominion.Player('Annie') self.player2 = Dominion.Player('Carla')
#Define box box = testUtility.GetBoxes(nV) supply_order = testUtility.GetSupplyOrder() #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:
# -*- coding: utf-8 -*- """ Created on Sunday Jan 19 2020 @author: Luke Carter """ import Dominion import random import testUtility from collections import defaultdict #Get player names player_names = testUtility.GetPlayers(1) #Bug only 1 player #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 = testUtility.CreateBox(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']}
# -*- coding: utf-8 -*- """ Created on Sunday Jan 19 2020 @author: Luke Carter """ import Dominion import random import testUtility from collections import defaultdict #Get player names player_names = testUtility.GetPlayers(random.randint(2, 4)) #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 = testUtility.CreateBox(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']}