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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update backtracking/n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
  • Loading branch information
DavidBanda and cclauss authored Jul 5, 2020
commit 52223884c782033283687ae7351f1d6957057946
4 changes: 2 additions & 2 deletions backtracking/n_queens_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

We can visualize it like this: left diagonal = \ and right diagonal = /

On a chessboard vertical movement could be the rows and horizontal movement could be the columns.
On a chessboard vertical movement could be the rows and horizontal movement could be
the columns.
In programming we can use an array, and in this array each index could be the rows and
each value in the array could be the column. For example:

Expand Down Expand Up @@ -137,4 +138,3 @@ def dfs(possible_board, diagonal_right_collisions, diagonal_left_collisions, boa

n_queens_solution(4)