本文整理汇总了Python中fight.Fight.coin方法的典型用法代码示例。如果您正苦于以下问题:Python Fight.coin方法的具体用法?Python Fight.coin怎么用?Python Fight.coin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fight.Fight
的用法示例。
在下文中一共展示了Fight.coin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FightTest
# 需要导入模块: from fight import Fight [as 别名]
# 或者: from fight.Fight import coin [as 别名]
class FightTest(unittest.TestCase):
def setUp(self):
self.orc = Orc("PeshoOrc", 100, 1.2)
self.hero = Hero("PeshoHero", 100, "peshooo")
self.weapon1 = Weapon("axe", 50, 0.5)
self.weapon2 = Weapon("axe2", 70, 0.3)
self.fighting = Fight(self.hero, self.orc)
self.orc.weapon = self.weapon1
def test_init(self):
self.assertEqual(self.fighting.Orc,self.orc)
self.assertEqual(self.fighting.Hero,self.hero)
def test_coin(self):
arr = []
flag = [False, False]
for i in range(1, 100):
arr.append(self.fighting.coin())
for i in arr:
if i:
flag[0] = True
else:
flag[1] = True
self.assertEqual(flag, [True, True])
def test_simulate_fight(self):
self.assertEqual("PeshoOrc", self.fighting.simulate_fight())