Esempio n. 1
0
 def test_advanced_behaviour(self):
     with Context() as ctx:
         gc = ctx.game.GameContext.fromTwoRandomDecks()
         behaviour1 = GameStateValueBehaviour(ctx)
         behaviour2 = PlayRandomBehaviour()
         gc.setBehaviour(0, behaviour1.wrap(ctx))
         gc.setBehaviour(1, behaviour2.wrap(ctx))
         gc.play()
         self.assertTrue(gc.updateAndGetGameOver())
Esempio n. 2
0
 def test_advanced_behaviour(self):
     with Context() as ctx:
         gc = ctx.game.GameContext.fromTwoRandomDecks()
         behaviour1 = GameStateValueBehaviour(ctx)
         behaviour2 = PlayRandomBehaviour()
         gc.setBehaviour(0, behaviour1.wrap(ctx))
         gc.setBehaviour(1, behaviour2.wrap(ctx))
         # We'll just play one turn turns
         gc.init()
         gc.setActivePlayerId(0)
         gc.startTurn(0)
         while gc.takeActionInTurn():
             pass
         self.assertTrue(gc.getActionsThisTurn() > 0)
 def test_behaviour(self):
     with Context() as ctx:
         gc = ctx.game.GameContext.fromTwoRandomDecks()
         behaviour1 = PlayRandomBehaviour()
         behaviour2 = PlayRandomBehaviour()
         gc.getPlayer1().setBehaviour(behaviour1.wrap(ctx))
         gc.getPlayer2().setBehaviour(behaviour2.wrap(ctx))
         gc.play()
         self.assertTrue(gc.updateAndGetGameOver())