Exemple #1
0
def test_buyCard(x,c):
	g=d.initializeGame(x, [d.adventurer, d.ambassador, d.baron, d.council_room, d.cutpurse,
                            d.embargo, d.feast, d.gardens, d.great_hall,d.mine], 2)
		
	if g.numBuys<1 or g.supplyCount[c]==0 or g.coins<d.getCost(c):
		assert d.buyCard(c, g)==-1
	else:
		assert d.buyCard(c, g)==0
Exemple #2
0
def random_GameState(w,s):
	#x=random.randrange(2,5)
	g=d.initializeGame(w, [d.adventurer, d.ambassador, d.baron, d.council_room, d.cutpurse,
                            d.embargo, d.feast, d.gardens, d.great_hall,d.mine], s)
	for i in xrange(10):
		if d.isGameOver(g):
			break
		d.buyCard(random.randrange(7,17),g)
		d.playCard(len(g.hand[g.whoseTurn])-1,random.randrange(1,16),random.randrange(1,16),random.randrange(1,17),g)
		d.endTurn(g)
	return g
Exemple #3
0
def random_GameState2(w,s):
	cardlist=[d.adventurer, d.ambassador, d.baron, d.council_room, d.cutpurse,
                            d.embargo, d.feast, d.smithy, d.village,d.sea_hag]
	g=d.initializeGame(w, cardlist, s)
	for i in xrange(10):
		if d.isGameOver(g):
			break
		d.buyCard(random.choice(cardlist),g)
		d.playCard(len(g.hand[g.whoseTurn])-1,random.randrange(0,len(g.hand[g.whoseTurn])-1),random.choice(cardlist),random.choice(cardlist),g)
		d.endTurn(g)
	return g
Exemple #4
0
def buyCardTest():
	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)
	card=random.choice(game.kingdomCards)
	game.supplyCount[card]=random.randrange(0,31)
	game.coins=random.randrange(0,100)
	game.numBuys=random.randrange(0,10)
	
	d.buyCard(card,game)