本文整理汇总了Python中lib.game.Game.addPlayer方法的典型用法代码示例。如果您正苦于以下问题:Python Game.addPlayer方法的具体用法?Python Game.addPlayer怎么用?Python Game.addPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.game.Game
的用法示例。
在下文中一共展示了Game.addPlayer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_rotatesPlayersCorrectly
# 需要导入模块: from lib.game import Game [as 别名]
# 或者: from lib.game.Game import addPlayer [as 别名]
def test_rotatesPlayersCorrectly(self):
game = Game("SomeGameName", self.m)
game.addPlayer(self.j)
game.beginGame()
self.assertRegex(game.currentPlayer.name, self.j.name)
game.rotateCurrentPlayer()
self.assertRegex(game.currentPlayer.name, self.m.name)
示例2: test_returnsRotationOfPlayers
# 需要导入模块: from lib.game import Game [as 别名]
# 或者: from lib.game.Game import addPlayer [as 别名]
def test_returnsRotationOfPlayers(self):
game = Game("SomeGame", self.m)
game.addPlayer(self.j)
game.beginGame()
self.assertEqual(len(game.currentTurn), 1)
self.assertRegex(game.currentPlayer.name, self.j.name)
nextPlayer = game.getNextPlayer()
self.assertRegex(nextPlayer.name, self.m.name)
nextPlayer = game.getNextPlayer()
self.assertRegex(nextPlayer.name, self.j.name)
示例3: test_dealCardsDealsCorrectly
# 需要导入模块: from lib.game import Game [as 别名]
# 或者: from lib.game.Game import addPlayer [as 别名]
def test_dealCardsDealsCorrectly(self):
deck = Deck()
game = Game('SomeGameName', self.m)
game.addPlayer(self.j) # This isn't really necessary.
game.dealCards([self.m, self.j], deck)
self.assertEqual(self.m.hand.size(), 3)
self.assertEqual(self.m.up.size(), 3)
self.assertEqual(self.m.down.size(), 3)
self.assertEqual(self.j.hand.size(), 3)
self.assertEqual(self.j.up.size(), 3)
self.assertEqual(self.m.down.size(), 3)
self.assertEqual(deck.size(), (52 - 18))