From 31b34af9fa7e09b4832af36071be86df37959e0d Mon Sep 17 00:00:00 2001 From: DukicDev Date: Sat, 2 Oct 2021 15:37:28 +0200 Subject: [PATCH] Correct grammar in backtracking/n_queens_math.py (#4869) --- backtracking/n_queens_math.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backtracking/n_queens_math.py b/backtracking/n_queens_math.py index c12aa6c33..2de784ded 100644 --- a/backtracking/n_queens_math.py +++ b/backtracking/n_queens_math.py @@ -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. """