chess.js
chess.js copied to clipboard
#186 First rough implementation for computing attacking and defending moves
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 optiondefending_alllowed
(default: false) which includes those defending moves as well.