(state, neighbors)
| 130 | |
| 131 | print("Example 5") |
| 132 | def game_logic(state, neighbors): |
| 133 | if state == ALIVE: |
| 134 | if neighbors < 2: |
| 135 | return EMPTY # Die: Too few |
| 136 | elif neighbors > 3: |
| 137 | return EMPTY # Die: Too many |
| 138 | else: |
| 139 | if neighbors == 3: |
| 140 | return ALIVE # Regenerate |
| 141 | return state |
| 142 | |
| 143 | assert game_logic(ALIVE, 0) == EMPTY |
| 144 | assert game_logic(ALIVE, 1) == EMPTY |
no test coverage detected