[英]How to get a 4v4 chess board version using the python chess library
I am trying to figure out how to use the chess library in python to get a 4x4
board instead of an 8x8
with Rook, Queen, King, and Rook at the back and the middle rows being Pawns.我试图弄清楚如何使用 python 中的国际象棋库来获得
4x4
棋盘而不是8x8
棋盘,后面有 Rook、Queen、King 和 Rook,中间行是 Pawn。
I tried setting up the board through this line but it gives an error saying that it expects 8
columns per row in position apart of fen我尝试通过这条线设置电路板,但它给出了一个错误,说它预计 position 中每行
8
列除了 fen
board = chess.Board("rqkr/pppp1Qpp/2n2n2/4p3/2B1P3/8/PPPP1PPP/RNB1K1NR b KQkq - 0 4")
I just would like to get a working 4x4
board instead of 8x8
.我只想得到一个工作
4x4
板而不是8x8
。
Any help is appreciated.任何帮助表示赞赏。
I do not think there is a possible way to do so with the python-chess library.我不认为使用 python-chess 库可以做到这一点。 You might have to make a new 4x4 board class with pure python.
您可能必须使用纯 python 制作新的 4x4 板 class。
Python chess only supports boards for registered variants . Python 国际象棋仅支持已注册变体的棋盘。
None of the registered variants include a 4x4 board.所有已注册的变体均不包括 4x4 板。
Also since you passed the board fen into a standard board class it threw an error since it expects the board to have 8 rows and columns.此外,由于您将板 fen 传递到标准板 class 中,因此它引发了错误,因为它预计板有 8 行和 8 列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.