inWinRegion method
Determins whether piece
(including colour) is in one of its win
regions, if it has any.
Implementation
bool inWinRegion(int piece, int square) {
if (!pieceHasWinRegions(piece)) return false;
for (String r in winRegions[piece]!) {
final region = regions[r];
if (region == null) continue;
if (region.containsSquare(square)) {
return true;
}
}
return false;
}