简体   繁体   English

如何获取FEN位置的字符串

[英]How to get a string of the FEN position

After I do在我做之后

import chess
board = chess.Board()

how can I have a string with the FEN of the position?我怎样才能得到一个带有位置 FEN 的字符串? In other words, how can I extract from board the FEN of the position as a string, with the same output as if I did换句话说,我如何从board中提取位置的 FEN 作为字符串,输出与我所做的相同

a='rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'

?

You can use the fen function.您可以使用fen功能。

board = chess.Board()
a = board.fen()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM