user21255: 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?

user18809: 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
  }
}


21255: <p>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.</p>

<p>Is there any easy way?</p>
 18809: <p>Shouldn't something like the folowing be good enough? (* stands for however you check that <code>potentialDefendingPiece</code>can move to <code>piece</code>'s square)</p>
<pre><code>for (piece in WhitePieces) {
  defended = false;
  for (potentialDefendingPiece in WhitePieces) {
    if(*)
     defended = true
  }
}
</code></pre>
