The 8-Queens Problem :
The Bounding function for 8-queens problem is
No two queens placed on the same column → xi's are distinct
No two queens placed on the same diagonal → how to test?
The same value of "row-column" or "row+column" indicates that two queens placed on the same diagonal.
Supposing two queens on (i,j) and (k,1)
i-j=k-1(i.e,j-1=i-k) or i+j = k+1(i.e, j-1 = k-i)
So, two queens placed on the same diagonal iff
[j-i] = [i-k]
The Bounding function for 8-queens problem is
No two queens placed on the same column → xi's are distinct
No two queens placed on the same diagonal → how to test?
The same value of "row-column" or "row+column" indicates that two queens placed on the same diagonal.
Supposing two queens on (i,j) and (k,1)
i-j=k-1(i.e,j-1=i-k) or i+j = k+1(i.e, j-1 = k-i)
So, two queens placed on the same diagonal iff
[j-i] = [i-k]
No comments:
Post a Comment