Algorithm for checking diagonal in N queens algortihm
<p>I am trying to implement N- Queens problem in python. I need a small help in designing the algorithm to check if given a position of Queen check whether any other queen on the board is present on its diagonal or not.</p>

<p>I am trying to design a function diagonal_check(board, row, col) where board is N*N matrix of arrays where '1' represents presence of queen and '0' represents absence.
I will pass array and position of queen (row,col) to the function. My function must return false if any other queen is present on its diagonal or else return true.</p>

<p>If anyone could help me with algorithm for diagonal_check function. Not looking for any specific language code.</p>

<p>Let the top left corner be (0,0)</p>

<p>The down-right oriented diagonal for a square (row,col) is <code>col-row+7</code></p>

<p>The up-right oriented diagonal for a square (row,col) is <code>row+col</code></p>

<p>Simply check if 2 queens have the same <code>col-row+7</code> or <code>row+col</code> should tell you if 2 queens are on the same diagonal. If you still are a bit confused, look up Google for a chessboard image.</p>

python algorithm language-agnostic n-queens