From 8cb957f893e88f4590377e42db371cbe859bb63d Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 27 Apr 2020 18:40:46 +0200 Subject: [PATCH] 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> --- .travis.yml | 2 +- DIRECTORY.md | 4 ++++ cellular_automata/one_dimensional.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b9c47c179..c19ae42ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ os: linux -dist: bionic +dist: focal language: python python: 3.8 cache: pip diff --git a/DIRECTORY.md b/DIRECTORY.md index 5025fde4a..777f5d34f 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -27,6 +27,9 @@ ## Boolean Algebra * [Quine Mc Cluskey](https://github.com/TheAlgorithms/Python/blob/master/boolean_algebra/quine_mc_cluskey.py) +## Cellular Automata + * [One Dimensional](https://github.com/TheAlgorithms/Python/blob/master/cellular_automata/one_dimensional.py) + ## Ciphers * [Affine Cipher](https://github.com/TheAlgorithms/Python/blob/master/ciphers/affine_cipher.py) * [Atbash](https://github.com/TheAlgorithms/Python/blob/master/ciphers/atbash.py) @@ -148,6 +151,7 @@ * [Index Calculation](https://github.com/TheAlgorithms/Python/blob/master/digital_image_processing/index_calculation.py) * Rotation * [Rotation](https://github.com/TheAlgorithms/Python/blob/master/digital_image_processing/rotation/rotation.py) + * [Sepia](https://github.com/TheAlgorithms/Python/blob/master/digital_image_processing/sepia.py) * [Test Digital Image Processing](https://github.com/TheAlgorithms/Python/blob/master/digital_image_processing/test_digital_image_processing.py) ## Divide And Conquer diff --git a/cellular_automata/one_dimensional.py b/cellular_automata/one_dimensional.py index 98d6fa25d..7819088c8 100644 --- a/cellular_automata/one_dimensional.py +++ b/cellular_automata/one_dimensional.py @@ -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])