Commit Graph

25 Commits

Author SHA1 Message Date
Maxim Smolskiy
516a3028d1
Enable ruff PLR5501 rule (#11332)
* Enable ruff PLR5501 rule

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-28 18:25:41 +01:00
pre-commit-ci[bot]
bc8df6de31
[pre-commit.ci] pre-commit autoupdate (#11322)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.2...v0.3.2)
- [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-13 07:52:41 +01:00
omahs
b203150ac4
Fix typos (#9076)
* fix typo

* fix typo

* fix typos

* fix typo
2023-09-23 10:53:09 +02:00
Caeden Perelli-Harris
04fd5c1b5e
Create langtons ant algorithm (#8967)
* updating DIRECTORY.md

* feat(cellular_automata): Langonts ant algorithm

* updating DIRECTORY.md

* Update cellular_automata/langtons_ant.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Apply suggestions from code review

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* fix(langtons-ant): Set funcanimation interval to 1

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-21 16:20:51 -07:00
Caeden Perelli-Harris
9d86d4edaa
Create wa-tor algorithm (#8899)
* feat(cellular_automata): Create wa-tor algorithm

* updating DIRECTORY.md

* chore(quality): Implement algo-keeper bot changes

* Update cellular_automata/wa_tor.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor(repr): Return repr as python object

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* refactor(display): Rename to display_visually to visualise

* refactor(wa-tor): Use double for loop

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* chore(wa-tor): Implement suggestions from code review

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-13 17:58:17 -07:00
Minha, Jeong
f8fe72dc37
Update game_of_life.py (#4921)
* Update game_of_life.py

docstring error fix
delete no reason delete next_gen_canvas code(local variable)

* Update cellular_automata/game_of_life.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-31 14:24:12 -07:00
Caeden Perelli-Harris
93fb169627
[Upgrade Ruff] Fix all errors raised from ruff (#8879)
* chore: Fix tests

* chore: Fix failing ruff

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* chore: Fix ruff errors

* chore: Fix ruff errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update cellular_automata/game_of_life.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* chore: Update ruff version in pre-commit

* chore: Fix ruff errors

* Update edmonds_karp_multiple_source_and_sink.py

* Update factorial.py

* Update primelib.py

* Update min_cost_string_conversion.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-07-22 12:05:10 +02:00
Pronoy Mandal
91cc3a240f
Update game_of_life.py (#8703)
Rectify spelling in docstring
2023-05-10 21:34:36 +12:00
Mark Mayo
f32d611689
clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
Tianyi Zheng
cc10b20beb
Remove some print statements within algorithmic functions (#7499)
* Remove commented-out print statements in algorithmic functions

* Encapsulate non-algorithmic code in __main__

* Remove unused print_matrix function

* Remove print statement in __init__

* Remove print statement from doctest

* Encapsulate non-algorithmic code in __main__

* Modify algorithm to return instead of print

* Encapsulate non-algorithmic code in __main__

* Refactor data_safety_checker to return instead of print

* updating DIRECTORY.md

* updating DIRECTORY.md

* Apply suggestions from code review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-22 13:33:51 +02:00
Leoriem-code
6314195bb1
Add README files 2/8 (#5766)
* add 5 README files

* empty commit to (hopefully) get rid of the `test-are-failling` label

* Update ciphers/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update conversions/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update cellular_automata/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update computer_vision/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update conversions/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update compression/README.md

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-11 21:39:54 +08:00
Leoriem-code
8e857e8692
add implementation of Nagel and Schrekenberg algo (#5584)
* add implementation of Nagel and Schrekenberg algo

* Update cellular_automata/nasch.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update nasch.py

* Update and rename nasch.py to nagel_schrekenberg.py

* Update cellular_automata/nagel_schrekenberg.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update nagel_schrekenberg.py

* Update nagel_schrekenberg.py

* Update nagel_schrekenberg.py

* update nagel_schrekenberg.py

* Update nagel_schrekenberg.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-26 09:57:49 +02:00
Erwin Junge
d924a8051b
[mypy] Add missing type annotation (#5491) 2021-10-22 17:45:30 +08:00
Erwin Junge
83a63d9c22
[mypy] Add missing type annotation in conways_game_of_life.py (#5490) 2021-10-22 12:14:45 +08:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
algobytewise
ce99859ad5
Move files to various folders (#4286)
* Move files to cellular_automata

* Rename other/davis–putnam–logemann–loveland.py to backtracking/davis–putnam–logemann–loveland.py

* Rename other/markov_chain.py to graphs/markov_chain.py

* undid rename: need to fix mypy first
2021-03-22 10:54:04 +01:00
Novice :)
2c6f553ccb
[mypy] Fix type annotations for cellular_automata (#4236)
* [mypy] Fix type annotations for cellullar_automata

* mypy --ignore-missing-imports

* mypy --ignore-missing-imports

* Blank lines

* Blank lines

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-03-20 07:32:16 +01:00
algobytewise
2a6e4bbdb6
[mypy] Add/fix type annotations for "conways_game_of_life.py" & "one_dimensional.py" (#4216)
Related Issue: #4052
2021-02-22 00:54:29 +01:00
jenra
5de90aafc7
Hacktoberfest 2020: Conway's Game of Life (#3070)
* Created conways_game_of_life.py

* Added new_generation(list[int[int]]) -> list[list[int]]

* Added glider example

* Added comments and shortened glider example

* Fixed index out of bounds error

* Added test

* Added blinker example

* Added ability to generate images

* Moved image generating code into a separate function

* Added comments

* Comment

* Reformatted file

* Formatting

* Removed glider test

* Update cellular_automata/conways_game_of_life.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update conways_game_of_life.py

* Update conways_game_of_life.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-11-29 17:09:33 +01:00
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
Christian Clauss
9200a2e543
from __future__ import annotations (#2464)
* from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-23 13:30:13 +02:00
Hasenn
10aa214fcb
Docstrings and formatting improvements (#2418)
* Fix spelling in docstrings

* Improve comments and formatting

* Update print statement to reflect doctest change

* improve phrasing and apply black

* Update rat_in_maze.py

    This method is recursive starting from (i, j) and going in one of four directions:
    up, down, left, right.
    If a path is found to destination it returns True otherwise it returns False.

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-14 14:40:27 +02:00
Christian Clauss
8cb957f893
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>
2020-04-27 18:40:46 +02:00
8Dion8
0ef9dd3977
Create one_dimensional.py (#1905)
* Create one_dimensional.py

* Update cellular_automata/one_dimensional.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update cellular_automata/one_dimensional.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update one_dimensional.py

Moved import to the top so that the type Image gets recognized

* Update one_dimensional.py

* Update cellular_automata/one_dimensional.py

* Update cellular_automata/one_dimensional.py

* Update one_dimensional.py

* Update one_dimensional.py

* Update one_dimensional.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-27 18:07:31 +02:00
Christian Clauss
b560b76002
Add cellular_automata directory (#1902)
Related to https://github.com/TheAlgorithms/Python/issues/1613#issuecomment-618175224 @8Dion8 Your review please.  Once this land, this directory would be a great place for you to add your work.
2020-04-23 11:57:32 +02:00