Correct grammar in backtracking/n_queens_math.py (#4869)

This commit is contained in:
DukicDev 2021-10-02 15:37:28 +02:00 committed by GitHub
parent 6341f351aa
commit 31b34af9fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
r"""
Problem:
The n queens problem is of placing N queens on a N * N chess board such that no queen
The n queens problem is: placing N queens on a N * N chess board such that no queen
can attack any other queens placed on that chess board. This means that one queen
cannot have any other queen on its horizontal, vertical and diagonal lines.
@ -31,7 +31,7 @@ So if we use an array and we verify that each value in the array is different to
other we know that at least the queens can't attack each other in horizontal and
vertical.
At this point we have that halfway completed and we will treat the chessboard as a
At this point we have it halfway completed and we will treat the chessboard as a
Cartesian plane. Hereinafter we are going to remember basic math, so in the school we
learned this formula:
@ -47,7 +47,7 @@ This formula allow us to get the slope. For the angles 45º (right diagonal) and
See::
https://www.enotes.com/homework-help/write-equation-line-that-hits-origin-45-degree-1474860
Then we have this another formula:
Then we have this other formula:
Slope intercept:
@ -59,7 +59,7 @@ we would have:
y - mx = b
And like we already have the m values for the angles 45º and 135º, this formula would
And since we already have the m values for the angles 45º and 135º, this formula would
look like this:
45º: y - (1)x = b
@ -71,7 +71,7 @@ look like this:
y = row
x = column
Applying this two formulas we can check if a queen in some position is being attacked
Applying these two formulas we can check if a queen in some position is being attacked
for another one or vice versa.
"""