Blacken one_dimensional.py (#1911)
* Blacken one_dimensional.py * updating DIRECTORY.md * Travis CI: Upgrade to Ubuntu 20.04 LTS Focal Ubuntu 20.04 LTS (Focal Fossa) https://releases.ubuntu.com/focal Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@@ -33,7 +33,7 @@ def new_generation(cells: List[List[int]], rule: List[int], time: int) -> List[i
|
||||
for i in range(population):
|
||||
# Get the neighbors of each cell
|
||||
left_neighbor = 0 if i == 0 else cells[time][i - 1] # special: leftmost cell
|
||||
right_neighbor = 0 if i == population - 1 else cells[time][i + 1] # rightmost
|
||||
right_neighbor = 0 if i == population - 1 else cells[time][i + 1] # rightmost
|
||||
# Define a new cell and add it to the new generation
|
||||
situation = 7 - int(f"{left_neighbor}{cells[time][i]}{right_neighbor}", 2)
|
||||
next_generation.append(rule[situation])
|
||||
|
||||
Reference in New Issue
Block a user