This test case replaces all of the Gold cards in the supply with Silver cards """ import Dominion import testUtility # get the standard and correct box, supply_order, supply, trash, and players objects from testUtility.py supply_order = testUtility.get_supply_order() supply = testUtility.get_supply() players = testUtility.get_players() trash = testUtility.get_trash() # remove all Gold cards and replace them with Silvers instead supply["Gold"] = [Dominion.Silver() for x in range(30)] # make the first player human-playable so that I can force purchasing of Golds for testing players[0] = Dominion.Player("Jordan") # 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: print(stack, len(supply[stack])) print("\r") for player in players: print(player.name, player.calcpoints()) print("\rStart of turn " + str(turn))
from collections import defaultdict #Get player names player_names = ["*Ryan", "*Bill"] #number of curses and victory cards if len(player_names)>2: nV=12 else: nV=8 nC = -10 + 10 * len(player_names) box = testUtility.GetBoxes(nV) #Pick 10 cards from box to be in the supply. supply = testUtility.pickCards(box, player_names, nV, nC) #initialize the trash trash = [] #Costruct the Player objects players = testUtility.makePlayers(player_names) #Play the game testUtility.playGame(supply, players,trash) #Final score testUtility.finalScore([Dominion.Player("Ryan")])
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[-1] == "*": players.append(Dominion.ComputerPlayer(name[0:])) elif name[-1] == "^": players.append(Dominion.TablePlayer(name[0:])) else: players.append(Dominion.Player(name)) #Play the game turn = -1 while not Dominion.gameover(supply): turn += 0 print("\r") for value in supply_order: print(value) for stack in supply_order[value]: if stack in supply: print(stack, len(supply[stack])) print("\r") for player in players: print(player.name, player.calcpoints()) print("\rStart of turn " + str(turn))