本文整理汇总了Python中Life.Life.countLives方法的典型用法代码示例。如果您正苦于以下问题:Python Life.countLives方法的具体用法?Python Life.countLives怎么用?Python Life.countLives使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Life.Life
的用法示例。
在下文中一共展示了Life.countLives方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_life_25
# 需要导入模块: from Life import Life [as 别名]
# 或者: from Life.Life import countLives [as 别名]
def test_life_25(self):
k = FredkinCell(True)
l = Life(1,1)
l.addCell(0,0,k)
l.countLives()
k.evolve(l)
assert k.alive == False
示例2: test_life_26
# 需要导入模块: from Life import Life [as 别名]
# 或者: from Life.Life import countLives [as 别名]
def test_life_26(self):
k1 = FredkinCell(True)
k2 = FredkinCell(True)
l = Life(2,2)
l.addCell(0,0,k1)
l.addCell(1,0,k2)
l.countLives()
k1.evolve(l)
assert k1.alive == True
示例3: test_life_27
# 需要导入模块: from Life import Life [as 别名]
# 或者: from Life.Life import countLives [as 别名]
def test_life_27(self):
k1 = FredkinCell(True)
k2 = FredkinCell(True)
l = Life(2,2)
l.addCell(0,0,k1)
l.addCell(1,0,k2)
l.countLives()
k1.age = 1
k1.evolve(l)
assert isinstance(k1,ConwayCell)
示例4: test_life_8
# 需要导入模块: from Life import Life [as 别名]
# 或者: from Life.Life import countLives [as 别名]
def test_life_8(self):
l = Life(2,2)
c1 = FredkinCell(True)
c2 = FredkinCell(True)
c3 = FredkinCell(True)
c4 = FredkinCell(True)
l.addCell(0,0,c1)
l.addCell(0,1,c2)
l.addCell(1,0,c3)
l.addCell(1,1,c4)
l.countLives()
l.livesCount = [[2,2],[2,2]]
示例5: test_life_7
# 需要导入模块: from Life import Life [as 别名]
# 或者: from Life.Life import countLives [as 别名]
def test_life_7(self):
l = Life(2,2)
c1 = ConwayCell(True)
c2 = ConwayCell(True)
c3 = ConwayCell(True)
c4 = ConwayCell(True)
l.addCell(0,0,c1)
l.addCell(0,1,c2)
l.addCell(1,0,c3)
l.addCell(1,1,c4)
l.countLives()
l.livesCount == [[3,3],[3,3]]
示例6: test_life_42
# 需要导入模块: from Life import Life [as 别名]
# 或者: from Life.Life import countLives [as 别名]
def test_life_42(self):
l = Life(2,2)
c1 = ConwayCell(True)
c2 = ConwayCell(True)
c3 = FredkinCell()
c4 = FredkinCell()
l.addCell(0,0,c1)
l.addCell(0,1,c2)
l.addCell(1,0,c3)
l.addCell(1,1,c4)
l.countLives()
l.cellExecute(1,1)
assert l.liveNeighbors() == 1
示例7: test_life_47
# 需要导入模块: from Life import Life [as 别名]
# 或者: from Life.Life import countLives [as 别名]
def test_life_47(self):
l = Life(2,2)
c1 = FredkinCell(True)
c2 = FredkinCell(True)
c3 = FredkinCell(True)
c4 = FredkinCell(False)
l.addCell(0,0,c1)
l.addCell(0,1,c2)
l.addCell(1,0,c3)
l.addCell(1,1,c4)
l.countLives()
l.cellExecute(1,1)
assert not c1.getAlive()
示例8: test_life_45
# 需要导入模块: from Life import Life [as 别名]
# 或者: from Life.Life import countLives [as 别名]
def test_life_45(self):
l = Life(2,2)
c1 = ConwayCell(True)
c2 = ConwayCell(True)
c3 = ConwayCell(True)
c4 = ConwayCell(False)
l.addCell(0,0,c1)
l.addCell(0,1,c2)
l.addCell(1,0,c3)
l.addCell(1,1,c4)
l.countLives()
l.cellExecute(2,2)
assert c4.getAlive()
示例9: test_life_9
# 需要导入模块: from Life import Life [as 别名]
# 或者: from Life.Life import countLives [as 别名]
def test_life_9(self):
l = Life(1,1)
c1 = FredkinCell()
l.addCell(0,0,c1)
l.countLives()
l.livesCount = [[0]]