from time import sleep from app.game import state_to_str, random_state, transition state = random_state(50, 50) while (True): state = transition(state) print('\033[H') print('\033[2J') print(state_to_str(state)) sleep(0.05) if not any(state): print('The game is over!') break
def test_overpopulation_five_neighbors(self, state: State): state = TestTransition.state_with_n_neighbors(4) next_state = transition(state) assert not next_state.board[4]
def test_underpopulation_one_neighbor(self, state: State): state = TestTransition.state_with_n_neighbors(1) next_state = transition(state) assert not next_state.board[4]
def test_live_three_neighbor(self, state: State): state = TestTransition.state_with_n_neighbors(3) next_state = transition(state) assert next_state.board[4]
def test_reproduction(self, state: State): state = TestTransition.state_with_n_neighbors(3, False) next_state = transition(state) assert next_state.board[4]