Changes

Jump to: navigation, search

Anti-Diagonals

790 bytes added, 14:38, 20 August 2020
no edit summary
! 0
|}
 
<span id="TwoSquares"></span>
=Two Squares on a Anti-Diagonal=
Two [[Squares]] are on the same Anti-Diagonal, if sum of file and rank distance is zero
<pre>
bool squaresOnSameAntiDiagonal(int sq1, int sq2) {
return ((sq2 - sq1) & 7) + ((sq2>>3) - (sq1>>3)) == 0;
}
</pre>
The [[Diagonals#TwoSquares|alternative approach]], to test whether the square difference is divisible by 7, would take extra conditions, since the outer squares of the main-diagonal (63-0) would wrongly classified otherwise <ref>[http://talkchess.com/forum3/viewtopic.php?f=7&t=74821 An undetected bug for 10 years] by [[Oliver Brausch]], [[CCC]], August 18, 2020</ref>
 
* [[Diagonals#TwoSquares|Two Squares on a Diagonal]]
* [[Files#TwoSquares|Two Squares on a File]]
* [[Ranks#TwoSquares|Two Squares on a Rank]]
=See also=

Navigation menu