Search code examples
pythonchesspython-chess

How to detect who is move white or black in python-chess library?


I am created some chess program and want to detect who have move white or black. Which objects stores information which pieces will move Board, GameNode?

import chess.pgn
import chess.uci

# ??? Board().is_white_move()?
# ??? GameNode.is_white_move()?

I analysed code but not found good explanation.


Solution

  • I assume that you are looking at python-chess.

    There's a turn attribute of the Board instance.