Skip to content

N queens math #2175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jul 10, 2020
Merged

N queens math #2175

merged 19 commits into from
Jul 10, 2020

Conversation

DavidBanda
Copy link
Contributor

@DavidBanda DavidBanda commented Jul 5, 2020

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@TravisBuddy
Copy link

Hey @DavidBanda,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: dec05400-be57-11ea-b6c3-5fc2c9c22d2c

@cclauss
Copy link
Member

cclauss commented Jul 5, 2020

How is this better than https://github.com/TheAlgorithms/Python/blob/master/backtracking/n_queens.py ?

@cclauss cclauss added tests are failing Do not merge until tests pass require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html labels Jul 5, 2020
DavidBanda and others added 4 commits July 4, 2020 22:30
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
@TravisBuddy
Copy link

Hey @DavidBanda,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: d95c4fc0-be78-11ea-b6c3-5fc2c9c22d2c

@TravisBuddy
Copy link

Hey @DavidBanda,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 7f03d7e0-be79-11ea-b6c3-5fc2c9c22d2c

@TravisBuddy
Copy link

Hey @DavidBanda,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: a5b11690-bfba-11ea-8212-0f9c14daf924

@TravisBuddy
Copy link

Hey @DavidBanda,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 13acf3c0-bfbc-11ea-8212-0f9c14daf924

@DavidBanda
Copy link
Contributor Author

Its not better than https://github.com/TheAlgorithms/Python/blob/master/backtracking/n_queens.py. Its just another solution to the problem of n queens.

@DavidBanda DavidBanda requested a review from cclauss July 7, 2020 04:04
Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add type hints and let's have depth_first_search() return a board (the search result) instead of passing in boards each time.

@TravisBuddy
Copy link

Hey @DavidBanda,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: ac9689d0-c08d-11ea-8f0c-c508e01afe59

@DavidBanda
Copy link
Contributor Author

Hey, how's it going? I added all the changes you requested except for the one that said to use boards as a local variable within depth_first_search() because I don't know how to do it without the algorithm misbehaving.

@DavidBanda DavidBanda requested a review from cclauss July 7, 2020 20:37
@cclauss
Copy link
Member

cclauss commented Jul 9, 2020

Sorry for the delay... I will review this and land it in 24 hours.

@DavidBanda
Copy link
Contributor Author

Don't worry about it

@cclauss cclauss removed require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html tests are failing Do not merge until tests pass labels Jul 10, 2020
@cclauss cclauss merged commit 05c14c6 into TheAlgorithms:master Jul 10, 2020
@cclauss
Copy link
Member

cclauss commented Jul 10, 2020

Thanks!

@DavidBanda DavidBanda deleted the n-queens-math branch July 11, 2020 01:06
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants