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
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
def test_endTurn(s): g=d.initializeGame(s, [d.adventurer, d.ambassador, d.baron, d.council_room, d.cutpurse, d.embargo, d.feast, d.gardens, d.great_hall,d.mine], 2) n=random.randrange(0,s) g.whoseTurn=n r=d.endTurn(g) if r==0: assert g.whoseTurn!=n
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) assert(d.endTurn(game)==0) assert(d.endTurn(game)==0) assert(d.endTurn(game)==0) assert(d.endTurn(game)==0)