8: ['Province'] } #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]) #The supply always has these cards supply["Copper"] = [Dominion.Copper()] * (60 - len(player_names) * 7) supply["Silver"] = [Dominion.Silver()] * 40 supply["Gold"] = [Dominion.Gold()] * 30 supply["Estate"] = [Dominion.Estate()] * nV supply["Duchy"] = [Dominion.Duchy()] * nV supply["Province"] = [Dominion.Province()] * nV supply["Curse"] = [Dominion.Curse()] * nC #initialize the trash trash = [] #Costruct the Player objects players = [] for name in player_names: if name[0] == "*": players.append(Dominion.ComputerPlayer(name[1:])) elif name[0] == "^": players.append(Dominion.TablePlayer(name[1:])) else: players.append(Dominion.Player(name))
#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]) #The supply always has these cards supply["Copper"]=[Dominion.Copper()]*(60-len(player_names)*7) supply["Silver"]=[Dominion.Silver()]*40 supply["Gold"]=[Dominion.Gold()]*0 # bug 0 gold cards supply["Estate"]=[Dominion.Estate()]*nV supply["Duchy"]=[Dominion.Duchy()]*1 supply["Province"]=[Dominion.Province()]*1 # Note bug 1 the first province is the last province supply["Curse"]=[Dominion.Curse()]*nC #initialize the trash trash = [] #Costruct the Player objects players = testUtility.InitializePlayers(player_names) #Play the game turn = 0 while not Dominion.gameover(supply): turn += 1 print("\r")