本文整理汇总了Python中Game.Game.add_ball方法的典型用法代码示例。如果您正苦于以下问题:Python Game.add_ball方法的具体用法?Python Game.add_ball怎么用?Python Game.add_ball使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Game
的用法示例。
在下文中一共展示了Game.add_ball方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: score_full_game
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import add_ball [as 别名]
def score_full_game(self, balls):
game = Game()
for ball in balls:
game.add_ball(ball)
return game.score()
示例2: check_full_game
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import add_ball [as 别名]
def check_full_game(self, expectedScore, balls):
game = Game()
for ball in balls:
game.add_ball(ball)
self.assertEquals(expectedScore, game.score())
示例3: test_add_second_ball
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import add_ball [as 别名]
def test_add_second_ball(self):
game = Game()
game.add_ball(1)
game.add_ball(2)
self.assertEquals(game.score(), 3)
self.assertEquals(game.current_frame(), 2)
示例4: test_strike
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import add_ball [as 别名]
def test_strike(self):
game = Game()
game.add_ball(10)
self.assertEquals(game.score(), 10)
self.assertEquals(game.current_frame(), 2)
示例5: test_add_ball
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import add_ball [as 别名]
def test_add_ball(self):
game = Game()
game.add_ball(1)
self.assertEquals(game.current_frame(), 1)
self.assertEquals(game.score(), 1)