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

Eclipse says "Possible assignment in condition" #10

Closed dlbbld closed 2 years ago

dlbbld commented 2 years ago

Eclipse marks the below code in dynamic.cpp:

// Do not reward while Loser has queen(s) if it was their turn
if (!isWinnersTurn && popcount(pos.pieces(loser, QUEEN)) > 0)
  variation = (variation = REWARD) ? NORMAL : variation;

// Do not reward after a certain depth
if (search.actual_depth() > 300)
  variation = (variation = REWARD) ? NORMAL : variation;

Because below code will always set variation to NORMAL:

variation = (variation = REWARD) ? NORMAL : variation;

However the intention is most likely:

variation = (variation == REWARD) ? NORMAL : variation;