Skip to content

Distinguish between standard and chess960 From Position games#1147

Merged
AttackingOrDefending merged 2 commits intolichess-bot-devs:masterfrom
MarkZH:from-position-960-fix
Oct 15, 2025
Merged

Distinguish between standard and chess960 From Position games#1147
AttackingOrDefending merged 2 commits intolichess-bot-devs:masterfrom
MarkZH:from-position-960-fix

Conversation

@MarkZH
Copy link
Copy Markdown
Collaborator

@MarkZH MarkZH commented Oct 11, 2025

Type of pull request:

  • Bug fix
  • Feature
  • Other

Description:

There is no indication in the GameFullEvent whether a From Position game uses Chess960 rules or not. This change determines what kind of game is being played by seeing whether the chess.Board option chess960=True changes the state of the board. If it does, then the game is a 960 game.

Related Issues:

Closes #1146

Checklist:

  • I have read and followed the contribution guidelines.
  • I have added necessary documentation (if applicable).
  • The changes pass all existing tests.

Screenshots/logs (if applicable):

A "From Position" game can encode a chess960 position, which would allow
chess960 challenges to bots that don't support them, leading to errors.
This change checks the FEN string to see if it is a 960 game and
declines the challenge if the bot does not play them.
@AttackingOrDefending
Copy link
Copy Markdown
Member

Is this ready to be merged, or do we wait for resolution to the weird castling fen described in the issue?

@MarkZH
Copy link
Copy Markdown
Collaborator Author

MarkZH commented Oct 14, 2025

It's ready to merge. The varying FENs from lichess are handled by python-chess. I may write a bug report to lichess at some point in the future. There's nothing to do about it here and it doesn't cause problems.

@AttackingOrDefending AttackingOrDefending merged commit 3d3b6c8 into lichess-bot-devs:master Oct 15, 2025
23 checks passed
@MarkZH MarkZH deleted the from-position-960-fix branch October 15, 2025 07:34
r0950336 pushed a commit to r0950336/lichess-bot that referenced this pull request Dec 31, 2025
…s-bot-devs#1147)

* Distinguish standard and 960 From Position games

* Prevent chess960 challenges to unsupported bots

A "From Position" game can encode a chess960 position, which would allow
chess960 challenges to bots that don't support them, leading to errors.
This change checks the FEN string to see if it is a 960 game and
declines the challenge if the bot does not play them.
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

Successfully merging this pull request may close these issues.

FromPosition matches with FRC castling rights are accepted and correctly handled by the Lichess GUI, but cause issues for lichess-bot

2 participants