* Remove redundent function
After reviewing this code, I've noticed that the `is_completed` function is a redundant operation.
Increasing the number of loops required for each step of the sudoku solver.
This should remove n² operations where n is the width of the grid.
* Update sudoku.py
Remove additional newline
* Added static typing to backtracking algorithms
* Ran psf/black to fix some minor issues.
* updating DIRECTORY.md
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
* added type hints and doctests for minimax algorithm
* Update backtracking/minimax.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* last fix
Co-authored-by: Christian Clauss <cclauss@me.com>
* 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>
* add new file for another solution to the n queens problem
* Add the code for the algorithm, add comments and add at the top a general explanation
* Update backtracking/n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update backtracking/n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update backtracking/n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update backtracking/n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* No newline at the end of the file
* Type hints
* whitespaces fixed
* Fixed whitespaces
* Add type hints
* CodeSpell fixed
* update
* All changes made except changing the board variable to local
* Add doctest
* Update
* Update
* Update
* Update n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Euler problem 551 sol 1: Reduce McCabe code complexity
As discussed in #2128
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Fix line break after binary operator
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Tighten up psf/black and flake8
* Fix some tests
* Fix some E741
* Fix some E741
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* spelling corrections
* review
* improved documentation, removed redundant variables, added testing
* added type hint
* camel case to snake case
* spelling fix
* review
* python --> Python # it is a brand name, not a snake
* explicit cast to int
* spaces in int list
* "!= None" to "is not None"
* Update comb_sort.py
* various spelling corrections in documentation & several variables naming conventions fix
* + char in file name
* import dependency - bug fix
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Simplify sudoku.is_completed() using builtin all()
Simplify __sudoku.is_completed()__ using Python builtin function [__all()__](https://docs.python.org/3/library/functions.html#all).
* fixup! Format Python code with psf/black push
* Update sudoku.py
* fixup! Format Python code with psf/black push
* Old style exception -> new style for Python 3
* updating DIRECTORY.md
* Update convex_hull.py
* fixup! Format Python code with psf/black push
* e.args[0] = "msg"
* ValueError: could not convert string to float: 'pi'
* Update convex_hull.py
* fixup! Format Python code with psf/black push
* minimax.py
minimax algorithm is used for game like tic tac toe. It traces the path and selects the optimal move.
* minimax.py
Minimax is used in decision making and game theory to find the optimal move for a player, when your opponent also plays optimally. It is widely used in games like Tic-Tac-Toe, Chess.
* Delete minimax.py
* Update minimax.py
* Minimax is a backtracking algorithm that is used in game theory to find the optimal move for a player, assuming that your opponent also plays optimally