File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
r"""
2
2
Problem:
3
3
4
- The n queens problem is of placing N queens on a N * N chess board such that no queen
4
+ The n queens problem is: placing N queens on a N * N chess board such that no queen
5
5
can attack any other queens placed on that chess board. This means that one queen
6
6
cannot have any other queen on its horizontal, vertical and diagonal lines.
7
7
31
31
other we know that at least the queens can't attack each other in horizontal and
32
32
vertical.
33
33
34
- At this point we have that halfway completed and we will treat the chessboard as a
34
+ At this point we have it halfway completed and we will treat the chessboard as a
35
35
Cartesian plane. Hereinafter we are going to remember basic math, so in the school we
36
36
learned this formula:
37
37
47
47
See::
48
48
https://www.enotes.com/homework-help/write-equation-line-that-hits-origin-45-degree-1474860
49
49
50
- Then we have this another formula:
50
+ Then we have this other formula:
51
51
52
52
Slope intercept:
53
53
59
59
60
60
y - mx = b
61
61
62
- And like we already have the m values for the angles 45º and 135º, this formula would
62
+ And since we already have the m values for the angles 45º and 135º, this formula would
63
63
look like this:
64
64
65
65
45º: y - (1)x = b
71
71
y = row
72
72
x = column
73
73
74
- Applying this two formulas we can check if a queen in some position is being attacked
74
+ Applying these two formulas we can check if a queen in some position is being attacked
75
75
for another one or vice versa.
76
76
77
77
"""
You can’t perform that action at this time.
0 commit comments