Skip to content

Legal Moves for a single cell #739

Answered by niklasf
ShebinJoseJacob asked this question in Q&A
Discussion options

You must be logged in to vote

You can filter legal moves by masks like

>>> list(board.generate_legal_moves(from_mask=chess.BB_B1))
[Move.from_uci('b1c3'), Move.from_uci('b1a3')]

Other useful masks: https://python-chess.readthedocs.io/en/latest/core.html#chess.BB_SQUARES

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ShebinJoseJacob
Comment options

Answer selected by ShebinJoseJacob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants