I saw the boolean expressions for the N Queens problem from here.
My modified N queens rules are simpler:
For a p $\times$ p chessboard I want to place N queens in such a way so that
- Queens will be placed adjacently, rows will be filled first.
- p $\times$ p chessboard size will be adjusted until it can hold N queens
For example, say N = $17$, then we need a $5\times5$ chessboard and the placement will be:
\begin{array}{|c|c|}\hline Q &Q &Q &Q &Q \\ \hline Q &Q &Q &Q &Q \\ \hline Q &Q &Q &Q &Q \\ \hline Q &Q & & & \\ \hline & & & & \\ \hline \end{array}
How would you build a boolean expression for this problem?