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')
Example #2
0
 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 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')
Example #5
0
    def test_gameover(self):
        # set up data
        self.set_up()
        game_over = Dominion.gameover(self.supply)
        self.assertEqual(False, game_over)

        # set province cards to 0 sets gameover to true
        self.supply["Province"] = [Dominion.Province()] * 0
        game_over = Dominion.gameover(self.supply)
        self.assertEqual(True, game_over)

        # set three supply piles to empty sets gameover to true
        self.supply = testUtility.getSupply(self.nV, self.nC,
                                            self.player_names, self.box)
        self.supply["Gold"] = [Dominion.Gold()] * 0
        self.supply["Estate"] = [Dominion.Estate()] * 0
        self.supply["Duchy"] = [Dominion.Duchy()] * 0
        game_over = Dominion.gameover(self.supply)
        self.assertEqual(True, game_over)
Example #6
0
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 13 10:27 2020

@author: Manda Jensen (mp-jensen)
"""

import testUtility

#Set the player names
#Introduce Test Scenario: Setting up the game with too many players
player_names = [
    "Annie", "*Ben", "*Carla", "*Josh", "*Rich", "*Judy", "*Susie", "*Erik"
]

#get the card box
box = testUtility.getBox(player_names)

#get the card supply for this specific game
supply = testUtility.getSupply(box, player_names)

#get the player objects
players = testUtility.getPlayers(player_names)

#Play the game
testUtility.playGame(supply, players)

#Calculate and print the final score
testUtility.scoreGame(players)
    5: [
        'Duchy', 'Market', 'Council Room', 'Festival', 'Laboratory', 'Library',
        'Mine', 'Witch'
    ],
    6: ['Gold', 'Adventurer'],
    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])

#adds default cards to the supply
supply = testUtility.getSupply(nV, supply, player_names, nC)

#initialize the trash
trash = []

#create player objects
players = testUtility.getPlayers(player_names)

#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]:
Example #8
0
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)

# Get supply order
supply_order = testUtility.getSupplyOrder()

# Pick 10 cards from box to be in the supply.
boxlist = testUtility.getBoxList(box)
random10 = testUtility.getRandom10(boxlist)
supply = testUtility.getSupply(box, random10)

# The supply always has these cards
supply = testUtility.getDefaultSupply(supply, player_names, nV, nC)

# initialize the trash
trash = []

# Construct the Player objects
players = testUtility.getPlayers(player_names)

# Play the game
turn = 0
while not Dominion.gameover(supply):
    turn += 1
    print("\r")
Example #9
0
player_names = ["Annie", "*Ben", "*Carla"]

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']
}

nV, nC = refactor.numCursesVictory(player_names)

#Define box
box = {}
supply = refactor.getSupply(nV, box)

refactor.addSupplyStandard(supply, player_names, nV, nC)

trash, players = refactor.initializeGame(player_names)

refactor.playGame(supply_order, players, supply, trash)

refactor.calcFinalScore(players)
Example #10
0
#Get player names
player_names = ["Annie","*Ben","*Carla"]

#Set up the number of curses and victory cards
nC = testUtility.getCurseCardCount(len(player_names))
nV = testUtility.getVictoryCardCount(len(player_names))

#Define box
box = testUtility.getBox(nV)

#Set supply order displayed when running the game
supply_order = testUtility.getSupplyOrder()

#Form the supply with 10 random cards from the box and all other standard setup.
supply = testUtility.getSupply(len(player_names), box, nC, nV, 10)

#INTRODUCE BUG: Change the cards called provinces in the supply to actually be estates
supply["Province"] = [Dominion.Estate()] * nV

#Initialize the trash
trash = []

#Costruct the Player objects
players = testUtility.getPlayers(player_names)

#Play the game
turn  = 0
while not Dominion.gameover(supply):
    turn += 1    
    print("\r")    
Example #11
0
from collections import defaultdict

#Get player names
player_names = testUtility.getPlayers()

#number of curses and victory cards
nV = testUtility.victoryCount(player_names)
nC = testUtility.cursesCount(player_names)

#Define box
box = testUtility.getBoxesForTest(nV)

supply_order = testUtility.getSupplyOrder()

#Define supply
supply = testUtility.getSupply(player_names, nV, nC, box)

#initialize the trash
trash = testUtility.initializeTrash()

#Costruct the Player objects
players = testUtility.constructPlayers(player_names)

#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]:
Example #12
0
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)

#Define box
box = testUtility.GetBoxes(nV)

supply_order = testUtility.GetSupplyOrder()

#Pick 10 cards from box to be in the supply.
supply = testUtility.getSupply(box, 10)

#The supply always has these cards
testUtility.fillSupply(
    supply, (60 - len(player_names) * 7), 40, 30, 1, 1, 1,
    nC)  #testing games with no victory cards (bug introduced)

#initialize the trash
trash = []

#Costruct the Player objects
players = testUtility.getPlayerList(player_names)

#Play the game
turn = 0
while not Dominion.gameover(supply):
Example #13
0
nC = -10 + 10 * len(player_names)

#Define box
box = testUtility.getBox(1) # fewer cards generated than required by the rules



#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 = testUtility.getSupply(0, nC, supply, player_names) # if nV is 0, then the game is ended automatically as there are no estates, duchy or province to be given

#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))

#Play the game
nC = -10 + 10 * len(player_names)

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']
}

supply = testUtility.getSupply(nV, player_names, box, nC)

#initialize the trash
trash = []

players = testUtility.constructPlayer(player_names)

testUtility.playGame(supply, supply_order, players, trash)

testUtility.finalScore(players)
Example #15
0
#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.GetBoxes(nV)

supply_order = testUtility.GetSupplyOrder()

#Pick 10 cards from box to be in the supply.
supply = testUtility.getSupply(
    box, 1
)  #bug introduced, only 1 randon card is picked from box, so supply only has one kind of item

#The supply always has these cards
testUtility.fillSupply(supply, (60 - len(player_names) * 7), 40, 30, nV, nV,
                       nV, 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] == "^":