miguel-ambrona / D3-Chess

Chess Unwinnability Analyzer is an implementation of a decision procedure for checking whether there exists a sequence of legal moves that allows a certain player to checkmate their opponent in a given chess position.
https://chasolver.org
GNU General Public License v3.0
51 stars 8 forks source link

Suggested paranthesis around expression #18

Closed dlbbld closed 2 years ago

dlbbld commented 2 years ago

The following line in semistatic.cpp is hard to read:

if (distance<Square>(s,t) == 1 && loserKingRegion & t) {

It's recommended to use parentheses to show evaluation precedence when using logical AND and bitwise AND in the same expression.

The code otherwise already follows this recommendation, like below in semistatic.cpp:

if ((visitors & s) && type_of(pos.piece_on(s)) != BISHOP)

As such I suggest to add parentheses in the expression as below: if (distance<Square>(s,t) == 1 && (loserKingRegion & t)) {