-
Notifications
You must be signed in to change notification settings - Fork 404
Odds generator #182
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
Odds generator #182
Conversation
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a dynamic odds selector feature for generating custom chess odds challenges on Lichess. The implementation introduces a Hugo shortcode system with page-specific CSS/JS loading capabilities.
Key Changes
- Implements a flexible asset loading system using Hugo's Page.Scratch to load CSS/JS on-demand
- Adds an interactive odds selector UI with support for standard and Fischer Random Chess (Chess960)
- Includes comprehensive validation logic for valid piece removal combinations
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| themes/leela/layouts/_partials/head/js.html | Adds dynamic JS loading from js/additional/ based on Page.Scratch |
| themes/leela/layouts/_partials/head/css.html | Adds dynamic CSS loading from css/additional/ based on Page.Scratch |
| themes/leela/layouts/_partials/head.html | Passes requiredCSS/JS to partialCached calls |
| themes/leela/assets/js/additional/odds.js | Complete odds selector logic with FEN generation and validation |
| themes/leela/assets/css/additional/odds.css | Styling for the odds selector interface |
| themes/leela/assets/css/icons.css | Adds external-link icon definition |
| layouts/shortcodes/odds-selector.html | Hugo shortcode that registers assets and renders the UI |
| content/play/odds.md | Page content invoking the odds-selector shortcode |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
While showing the actual board rank would be nice visually, for now I'm concerned it would add significant code complexity (or a lot of heavy dependency for a small visual improvement). I think checking the removed pieces works better conceptually since we're showing what Leela is giving up. This which aligns with the bots names ("LeelaKnightOdds", "LeelaQueenOdds", etc.) to indicate which piece is missing. |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
Hey :) Great work, thanks a lot! I tested the generated links with a few games against https://lichess.org/@/RefuteMyGambit and it seems to work as intended. I have a few comments about some design choices from my (brief) testing:
|
I have the side mostly for non-FRC chess, but I understand for FRC how it can be confusing. I disagree with "remove 0, 1, 2", the essentially a slider, to determine how many of each piece to remove, I think the user should have some choice in which one to remove. Here is a proposal from Gemini on labels to use:
Note the Left/Right also could be confusing when you flip the side the user is on, and is it the User's or Bot's left and right (I am OK changing that to Knight 1 and Knight 2) |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
Thanks a lot for the update!
|
|
I didn't mean implementing/using full chess board, just aligning checkboxes horiozntally and using chess pieces, like this:
https://claude.ai/public/artifacts/0be20e1a-cb81-4255-8eee-0b3f04688ff1 |
|
Or maybe even like that (not sure about blue color)
https://claude.ai/public/artifacts/f2102892-be21-4e79-a318-9384512635db |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
Thanks for the update! When reloading the page to get the update, I saw that reloading the page with the FRC checkmark set will show the regular labels for the knight/bishop boxes, only after taking it away and setting it again the FRC specific labels are displayed. |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
Thanks for clarifying on the design @mooskagh! The chess piece visualization is definitely appealing and intuitive for standard chess positions. However, there are some difficulties with implementing it this way.
While we could implement this visual approach for standard chess only, maintaining two different UI paradigms would complicate the codebase unnecessarily at this stage. For now, I'd like to keep the current form-based approach to ensure accuracy across all game modes, but I'd be happy to revisit this approach later. |
|
One possibility for 2. could be to show the 7 removable pieces in descending value order if in FRC mode, that way it's clear it doesn't represent the actual position. |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
🚀 Draft Preview: https://pr182-draft.lc0.org/ |
|
Perfect, FRC restrictions look good now! I obviously didn't check every possibility, but from what I could see it now matches what we decided for the FRC odds bot to accept. I also checked that it indeed refuses to accept 518. Thanks a lot for the work! |


This PR introduces a new page for generating custom chess odds challenge links.
Implementation Notes
While we generally avoid inline CSS, this page contains highly specialized styling that's unique to this component and unlikely to be reused elsewhereAdded functionality for thisDirect link to page added: https://pr182-draft.lc0.org/play/odds/