chess.js icon indicating copy to clipboard operation
chess.js copied to clipboard

#186 First rough implementation for computing attacking and defending moves

Open mliebelt opened this issue 6 years ago • 0 comments

See the discussion on the ticket 186 on GitHub.

My changes were the following:

  • Added attacked_pieces(color_code, attack_square)
    • color_code == null: if white is to move, search for attacked pieces by white ==> black pieces
    • color_code == WHITE|BLACK: search for the relevant color
    • attack_square (default: false): show attacked squares (without pieces) as well
  • Added defended_pieces(color_code, attack_square) with similar parameters
  • Made that 2 public available
  • Changed generate_moves to allow a search for defending moves as well (which means that moves will be returned that strike own pieces, which is a defense of the own pieces). To allow this, I have added the option defending_alllowed (default: false) which includes those defending moves as well.

mliebelt avatar Oct 30 '18 14:10 mliebelt