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

half-move counter seems to be broken. #2

Closed
phadej opened this issue May 15, 2021 · 3 comments
Closed

half-move counter seems to be broken. #2

phadej opened this issue May 15, 2021 · 3 comments

Comments

@phadej
Copy link
Contributor

phadej commented May 15, 2021

Thanks for this awesome library!

I think I found a small bug in move application, the half move counter doesn't seem to reset after pawn moves:

*Game.Chess> doPly startpos (move D2 D4)
"rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq d3 1 1"

It should be

"rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq d3 0 1"

(FWIW, lichess forget to mark enpassant square, though according to wikipedia

En passant target square in algebraic notation. If there's no en passant target square, this is "-". If a pawn has just made a two-square move, this is the position "behind" the pawn. This is recorded regardless of whether there is a pawn in position to make an en passant capture.

chess.com analysis includes d3).

EDIT: the counter doesn't seem to reset after captures either.

@mlang
Copy link
Owner

mlang commented May 15, 2021 via email

@phadej
Copy link
Contributor Author

phadej commented May 16, 2021

@mlang The same wikipedia page says

Halfmove clock: The number of halfmoves since the last capture or pawn advance, used for the fifty-move rule.

And the page about the Fifty-move rule

The fifty-move rule in chess states that a player can claim a draw if no capture has been made and no pawn has been moved in the last fifty moves (for this purpose a "move" consists of a player completing a turn followed by the opponent completing a turn). The purpose of this rule is to prevent a player with no chance of winning from obstinately continuing to play indefinitely[1] or seeking to win by tiring the opponent.

@mlang mlang closed this as completed in c2b1b90 May 17, 2021
@phadej
Copy link
Contributor Author

phadej commented May 17, 2021

Thanks for quick fixes!

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

No branches or pull requests

2 participants