I am looking for a script/code/CQL that searches for undefended pieces in a given position. I know that is possible to do it in the python chess library, but that is too complicated for me.
Is there any easy way?
I am looking for a script/code/CQL that searches for undefended pieces in a given position. I know that is possible to do it in the python chess library, but that is too complicated for me.
Is there any easy way?
Shouldn't something like the folowing be good enough? (* stands for however you check that potentialDefendingPiececan move to piece's square)
for (piece in WhitePieces) {
defended = false;
for (potentialDefendingPiece in WhitePieces) {
if(*)
defended = true
}
}
You can use "Chess Query Language" for coding this, as it will be quicker to work with and easier to understand.