def test_iteration_count(self): g = GameOfLife(set()) g.advance(0) self.assertEqual(0, g.iteration) g.advance(1) self.assertEqual(1, g.iteration) g.advance(10) self.assertEqual(11, g.iteration) g.advance(100) self.assertEqual(111, g.iteration)
def test_iteration_count(self): g = GameOfLife(set()) g.advance(0) self.assertEqual(0, g.iteration) g.advance(1) self.assertEqual(1, g.iteration) g.advance(10) self.assertEqual(11, g.iteration) g.advance(100) self.assertEqual(111, g.iteration)
def test_alternative_tick(self): """Test that we can switch to alternative tick functions""" g = GameOfLife(patterns.BEEHIVE, life_function=life_alternative) for i in range(10): self.assertEqual(patterns.BEEHIVE, g.advance(i))
def test_current(self): g = GameOfLife(patterns.BLINKER_P1) ptns = [patterns.BLINKER_P1, patterns.BLINKER_P2] for i in range(100): self.assertEqual(ptns[i % len(ptns)], g.current()) g.advance()
def test_beehive(self): # a beehive is a still life g = GameOfLife(patterns.BEEHIVE) for i in range(100): self.assertEqual(patterns.BEEHIVE, g.advance(i))
def test_block(self): # a block is a still life g = GameOfLife(patterns.BLOCK) for i in range(100): self.assertEqual(patterns.BLOCK, g.advance(i))
def test_alternative_tick(self): """Test that we can switch to alternative tick functions""" g = GameOfLife(patterns.BEEHIVE, life_function=life_alternative) for i in range(10): self.assertEqual(patterns.BEEHIVE, g.advance(i))
def test_current(self): g = GameOfLife(patterns.BLINKER_P1) ptns = [patterns.BLINKER_P1, patterns.BLINKER_P2] for i in range(100): self.assertEqual(ptns[i % len(ptns)], g.current()) g.advance()
def test_beehive(self): # a beehive is a still life g = GameOfLife(patterns.BEEHIVE) for i in range(100): self.assertEqual(patterns.BEEHIVE, g.advance(i))
def test_block(self): # a block is a still life g = GameOfLife(patterns.BLOCK) for i in range(100): self.assertEqual(patterns.BLOCK, g.advance(i))