getAttackers method

Set<int> getAttackers(
  1. int square,
  2. int player
)

Finds all the pieces for player attacking square. Returns a list of the squares those pieces are on.

Implementation

Set<int> getAttackers(int square, int player) =>
    generatePlayerMoves(player, MoveGenParams.squareAttacks(square, false))
        .map((e) => e.from)
        .toSet();