Skip to content

Commit

Permalink
Removed the cell
Browse files Browse the repository at this point in the history
I don't think the cell needs anything more than to hold its state. I may get rid of the object later and work on pure booleans
  • Loading branch information
jonodrew committed Nov 17, 2018
1 parent 8868a83 commit 7383b5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
8 changes: 0 additions & 8 deletions game.py
Expand Up @@ -3,14 +3,6 @@
class Cell:
def __init__(self, alive: bool=False):
self.alive = alive
self.fate = None

def die(self):
self.alive = False

def resurrect(self):
self.alive = True


class Grid:
def __init__(self, size):
Expand Down
13 changes: 2 additions & 11 deletions test_game.py
Expand Up @@ -13,7 +13,7 @@ def three_grid():
@pytest.fixture
def three_grid_with_horizontal_bar(three_grid):
for x in range(3):
three_grid.diagram[1][x].resurrect()
three_grid.diagram[1][x].alive = True
return three_grid

@pytest.fixture
Expand Down Expand Up @@ -48,7 +48,7 @@ def test_dead_cell_fate(self):
assert Grid.will_live([Cell(True)], False) is False

def test_get_cell_status(self, ten_grid):
ten_grid.diagram[0][0].resurrect()
ten_grid.diagram[0][0].alive = True
assert ten_grid.get_cell_status(0, 0) is True
assert ten_grid.get_cell_status(1, 1) is False

Expand All @@ -70,12 +70,3 @@ def test_determine_fates_of_all(self, three_grid_with_horizontal_bar):
class TestCell:
def test_cell_is_initialised_dead(self, cell):
assert not cell.alive

def test_cell_dies_when_passed_command(self, cell):
cell.alive = True
cell.die()
assert not cell.alive

def test_cell_resurrects_when_passed_command(self, cell):
cell.resurrect()
assert cell.alive

0 comments on commit 7383b5a

Please sign in to comment.