Board.fen() didn't update when ep_square is updated
winapiadmin@ubuntu:~/venv/bin$ source activate
(venv) winapiadmin@ubuntu:~/venv/bin$ python
Python 3.12.3 (main, Nov 6 2024, 18:32:19) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import chess
>>> chess.Board()
Board('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1')
>>> x=chess.Board()
>>> x.push_san("e4")
Move.from_uci('e2e4')
>>> x
Board('rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1')
>>> x.ep_square
20
>>> x.push_san("e5")
Move.from_uci('e7e5')
>>> x
Board('rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2')
OS:
(venv) winapiadmin@ubuntu:~/venv/bin$ neofetch
`-mddhhhhhhhhhddmss` winapiadmin@ubuntu
./mdhhhhhhhhhhhhhhhhhhhhhh. ------------------
:mdhhhhhhhhhhhhhhhhhhhhhhhhhhhm` OS: Lubuntu 24.04.1 LTS x86_64
:ymhhhhhhhhhhhhhhhyyyyyyhhhhhhhhhy: Kernel: 6.13.0-061300rc1-generic
`odhyyyhhhhhhhhhy+-````./syhhhhhhhho` Uptime: 50 mins
`hhy..:oyhhhhhhhy-`:osso/..:/++oosyyyh` Packages: 2235 (dpkg), 13 (snap)
dhhs .-/syhhhhs`shhhhhhyyyyyyyyyyyyhs Shell: bash 5.2.21
:hhhy` yso/:+syhy/yhhhhhshhhhhhhhhhhhhh: Resolution: 1440x900
hhhhho. +hhhys++oyyyhhhhh-yhhhhhhhhhhhhhs DE: LXQt 1.4.0
hhhhhhs-`/syhhhhyssyyhhhh:-yhhhhhhhhhhhhh WM: Openbox
hhhhhhs `:/+ossyyhyyhhhhs -yhhhhhhhhhhhh Theme: Breeze [GTK3]
hhhhhhy/ `syyyssyyyyhhhhhh: :yhhhhhhhhhhs Icons: ePapirus [GTK3]
:hhhhhhyo:-/osyhhhhhhhhhhho ohhhhhhhhhh: Terminal: qterminal
sdhhhhhhhyyssyyhhhhhhhhhhh+ +hhhhhhhhs Terminal Font: Ubuntu Mono 14
`shhhhhhhhhhhhhhhhhhhhhhy+` .yhhhhhhhh` CPU: Intel i3-2100 (4) @ 3.100GHz
+sdhhhhhhhhhhhhhhhhhyo/. `/yhhhhhhhd` GPU: Intel 2nd Generation Core Processor Family
`:shhhhhhhhhh+---..``.:+yyhhhhhhh: Memory: 1667MiB / 3367MiB
`:mdhhhhhh/.syssyyyyhhhhhhhd:`
`+smdhhh+shhhhhhhhhhhhdm`
`sNmdddhhhhhhhddm-`
Edit: hard-coded FEN generation without EPD is working:
winapiadmin@ubuntu:~/venv/bin$ source activate
(venv) winapiadmin@ubuntu:~/venv/bin$ python
Python 3.12.3 (main, Nov 6 2024, 18:32:19) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import chess
>>> chess.Board()
Board('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1')
>>> x=chess.Board()
>>> x.push_san("e4")
Move.from_uci('e2e4')
>>> f"{x.board_fen()} {"w" if x.turn else "b"} {x.castling_xfen()} {chess.square_name(x.ep_square) if x.ep_square else "-"} {x.halfmove_clock} {x.fullmove_number}"
'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1'
Hi. There are multiple standards for en passant in FENs. See https://python-chess.readthedocs.io/en/latest/core.html#chess.Board.fen:
board.fen(..., en_passant: Literal['legal', 'fen', 'xfen'] = 'legal')By default, only fully legal en passant squares are included (has_legal_en_passant()). Pass
fento strictly follow the FEN specification (always include the en passant square after a two-step pawn move) orxfento follow the X-FEN specification (has_pseudo_legal_en_passant()).
It should by default follows FEN specifications
From: Niklas Fiekas @.> Sent: Sunday, January 19, 2025 9:20 PM To: niklasf/python-chess @.> Cc: winapiadmin @.>; Author @.> Subject: Re: [niklasf/python-chess] Board.fen() didn't update when ep_square is updated (Issue #1134)
Hi. There are multiple standards for en passant in FENs. See https://python-chess.readthedocs.io/en/latest/core.html#chess.Board.fen:
board.fen(..., en_passant: Literal['legal', 'fen', 'xfen'] = 'legal')
By default, only fully legal en passant squares are included (has_legal_en_passant()https://python-chess.readthedocs.io/en/latest/core.html#chess.Board.has_legal_en_passant). Pass fen to strictly follow the FEN specification (always include the en passant square after a two-step pawn move) or xfen to follow the X-FEN specification (has_pseudo_legal_en_passant()https://python-chess.readthedocs.io/en/latest/core.html#chess.Board.has_pseudo_legal_en_passant).
— Reply to this email directly, view it on GitHubhttps://github.com/niklasf/python-chess/issues/1134#issuecomment-2600881537, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BBBOTBLEDKMHGJ3T3MOTE3L2LOYDBAVCNFSM6AAAAABVOXCO3CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBQHA4DCNJTG4. You are receiving this because you authored the thread.Message ID: @.***>