Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

en passant target square not populated when pawn moves 2 sqares #1082

Closed
sdxsharp opened this issue May 14, 2024 · 2 comments
Closed

en passant target square not populated when pawn moves 2 sqares #1082

sdxsharp opened this issue May 14, 2024 · 2 comments
Labels

Comments

@sdxsharp
Copy link

sdxsharp commented May 14, 2024

import chess

print(chess.__version__)
board = chess.Board()
board.set_fen('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1')
board.push_san('e4')
print(board.fen())

output:

1.10.0
rnbqkbnr/pppppppp/8/8/4P3/8/PPP1PPPP/RNBQKBNR b KQkq - 0 1

the en passant sqare is not populated!!!

output should be:

rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1

@MarkZH
Copy link
Contributor

MarkZH commented May 16, 2024

By default, the en passant square is only listed if there is a legal en passant move. If you want the usual FEN style, use print(board.fen(en_passant='fen')).

Board.fen() method parameter documentation

@sdxsharp
Copy link
Author

sdxsharp commented May 16, 2024

Thanks! I wish I could've found it myself in the docs, but for someone who never used python docs the search result looks like a hot mess (due to lack of class information and hard to parse optional arguments or even identify what is going on) and the navigation is also not super obvious (not sure why I didn't look in Core) (and even if I'd found the right class the font size for the actual functions is tiny af). Only now that I know how things are supposed to look like in the docs it actually seems possible to find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants