mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
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:
parent
0ef9dd3977
commit
8cb957f893
|
@ -1,5 +1,5 @@
|
|||
os: linux
|
||||
dist: bionic
|
||||
dist: focal
|
||||
language: python
|
||||
python: 3.8
|
||||
cache: pip
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue
Block a user