コード例 #1
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 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
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_18(self):
   k = AbstractCell(True)
   l = Life(1,1)
   l.addCell(0,0,k)
   k.evolve(l)
   k.evolve(l)
   k.evolve(l)
   assert k.alive
コード例 #3
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 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
コード例 #4
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 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)    
コード例 #5
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_10(self):
   l1 = Life(1,1)
   c1 = FredkinCell(True)
   l1.addCell(0,0,c1)
   l1.populationEvolve()
   
   l2 = Life(1,1)
   c2 = ConwayCell(True)
   l2.addCell(0,0,c2)
   l2.populationEvolve()
   
   assert str(l2) == '.' and str(l1) == '-' 
コード例 #6
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_5(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)
   
   assert str(l) == '00\n00'
コード例 #7
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_6(self):
   l = Life(2,2)
   c1 = ConwayCell(True)
   c2 = ConwayCell(False)
   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)
   
   assert str(l) == '*.\n0-'
コード例 #8
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_11(self):
   l = Life(2,2)
   c1 = FredkinCell(True)
   c2 = FredkinCell(False)
   c3 = FredkinCell(False)
   c4 = FredkinCell(False)
   l.addCell(0,0,c1)
   l.addCell(0,1,c2)
   l.addCell(1,0,c3)
   l.addCell(1,1,c4)
   l.populationEvolve()
   
   assert str(l) == '-0\n0-'
コード例 #9
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 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]]
コード例 #10
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 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]]
コード例 #11
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_40(self):
   l = Life(2,2)
   c1 = ConwayCell(True)
   c2 = ConwayCell(False)
   c3 = ConwayCell(False)
   c4 = ConwayCell(True)
   l.addCell(0,0,c1)
   l.addCell(0,1,c2)
   l.addCell(1,0,c3)
   l.addCell(1,1,c4)
   
   l.cellExecute(1,1)
   assert l.liveNeighbors() == 0
コード例 #12
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_12(self):
   l = Life(2,2)
   c1 = ConwayCell(True)
   c2 = ConwayCell(True)
   c3 = ConwayCell(False)
   c4 = ConwayCell(True)
   l.addCell(0,0,c1)
   l.addCell(0,1,c2)
   l.addCell(1,0,c3)
   l.addCell(1,1,c4)
   l.populationEvolve()
   
   assert str(l) == '**\n**'
コード例 #13
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_50(self):
   l = Life(2,2)
   c1 = FredkinCell(False)
   c2 = FredkinCell(False)
   c3 = FredkinCell(False)
   c4 = FredkinCell(False)
   
   l.addCell(0,0,c1)
   l.addCell(0,1,c2)
   l.addCell(1,0,c3)
   l.addCell(1,1,c4)
   
   assert l.getPopulation() == 0
コード例 #14
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 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
コード例 #15
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 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()
コード例 #16
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 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()
コード例 #17
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_9(self):
   l = Life(1,1)
   c1 = FredkinCell()
   l.addCell(0,0,c1)
   l.countLives()
   l.livesCount = [[0]]
コード例 #18
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_21(self):
   k = AbstractCell()
   l = Life(1,1)
   l.addCell(0,0,k)
   assert str(l) == '^'
コード例 #19
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life_16(self):
   k = AbstractCell()
   l = Life(1,1)
   l.addCell(0,0,k)
   k.evolve(l)
   assert not k.alive
コード例 #20
0
ファイル: TestLife.py プロジェクト: jjloftin/cs313e-life
 def test_life__4(self):
   l = Life(1,1)
   c = FredkinCell(True)
   l.addCell(0,0,c)
   str(l) == '0'