示例#1
0
def getWinnersTest():
	player=random.randrange(2,5)
	seed=random.randrange(3,11)

	game = d.initializeGame(player, [d.adventurer, d.ambassador, d.baron, d.council_room, d.cutpurse,
								d.embargo, d.feast, d.gardens, d.great_hall, d.mine], seed)
				
			
#for i in range(MAX_TEST):
	turn=random.randrange(0,player)
	game.whoseTurn=turn
	hand1=[]
	deck1=[]
	discard1=[]
	for i in range(player):
		hand1.append(random.randrange(0,MAX_HAND))
		deck1.append(random.randrange(0,MAX_DECK))
		discard1.append(random.randrange(0,MAX_DECK))
	for p in range(player):
		game.hand[p]=[]
		game.deck[p]=[]
		game.discard[p]=[]
		for a in range(hand1[p]):
			game.hand[p].append(random.randrange(d.curse,d.mine+1))
		for b in range(deck1[p]):
			game.deck[p].append(random.randrange(d.curse,d.mine+1))
		for c in range(discard1[p]):
			game.discard[p].append(random.randrange(d.curse,d.mine+1))
	d.getWinners(game)
示例#2
0
文件: qcheck.py 项目: huangca/work
def test_getWinners(s,w):
	g=random_GameState(w,s)
	r=d.getWinners(g)
	assert len(r)==w
示例#3
0
import dominion_p as d
import copy

game = d.initializeGame(
    2,
    [
        d.adventurer,
        d.ambassador,
        d.baron,
        d.council_room,
        d.cutpurse,
        d.embargo,
        d.feast,
        d.gardens,
        d.great_hall,
        d.mine,
    ],
    10,
)

# initialze state both player have same card in hand, deck and discard so same point,
# but second player less 1 turn
assert d.getWinners(game) == [0, 1]