Skip to content

Add visual aids in analysis board - #19037

Merged
ornicar merged 6 commits into
lichess-org:masterfrom
dav1312:pins-checkable-undefended-chessops-rebase
Jan 12, 2026
Merged

Add visual aids in analysis board#19037
ornicar merged 6 commits into
lichess-org:masterfrom
dav1312:pins-checkable-undefended-chessops-rebase

Conversation

@dav1312

@dav1312 dav1312 commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

Add visual aids for pins, undefended pieces, and checkable kings in analysis board


  • Introduces a new boardAnalysis module to detect motifs.

    • Enabled by default. Adds detectPins to identify absolute and significant relative pins.
    • Enabled by default. Adds detectUndefended using Static Exchange Evaluation (SEE) to find hanging or under-defended pieces.
    • Disabled by default. Adds detectCheckable to highlight kings that can be put in check on the next move (including via promotion, castling, or en passant).
  • Adds a toggle for each aid.

    image
  • Aids are disabled if engine eval is not allowed (e.g. correspondence analysis page).

  • To avoid unusual legal chess moves, aids are only available in standard, chess960, fromPosition, kingOfTheHill, threeCheck, and racingKings,

  • Includes unit tests.


This is how it currently looks.

image

The same piece can have multiple tags.

image

The functions return additional information that is not used for the shape creation but that could be useful in the future.

[
  { "pinned": 27, "pinner": 59, "target": 3 }
]
[
  { "square": 22, "materialLoss": 2, "principalAttacker": 50 },
  { "square": 37, "materialLoss": 1, "principalAttacker": 30 }
]
[
  { "king": 0, "check": { "from": 58, "to": 56 } },
  { "king": 55, "check": { "from": 53, "to": 61, "promotion": "knight" } }
]

Example of what could be done with the information provided by the functions:

image

@dav1312
dav1312 force-pushed the pins-checkable-undefended-chessops-rebase branch from 1e64887 to c61792b Compare January 5, 2026 11:15
@dav1312
dav1312 marked this pull request as draft January 5, 2026 14:51
@dav1312
dav1312 force-pushed the pins-checkable-undefended-chessops-rebase branch from 56a2861 to d9d7610 Compare January 5, 2026 16:57
@dav1312 dav1312 changed the title Add visual aids in analysis board Add visual aids in analysis board [RFC] Jan 6, 2026
@ornicar

ornicar commented Jan 9, 2026

Copy link
Copy Markdown
Collaborator

This looks great :) Let's go

@dav1312
dav1312 force-pushed the pins-checkable-undefended-chessops-rebase branch from d5cacc0 to 40dd539 Compare January 11, 2026 19:24
…nalysis board

- Introduces a new `boardAnalysis` module to detect motifs.
   - Adds `detectPins` to identify absolute and significant relative pins.
   - Adds `detectUndefended` using Static Exchange Evaluation (SEE) to find hanging or under-defended pieces.
   - Adds `detectCheckable` to highlight kings that can be put in check on the next move (including via promotion, castling, or en passant).
- Adds a toggle for each aid.
- Aids are disabled if engine eval is not allowed (e.g. correspondence analysis page).
- Includes unit tests.
@dav1312
dav1312 force-pushed the pins-checkable-undefended-chessops-rebase branch from 40dd539 to 77ffc13 Compare January 11, 2026 19:35
@dav1312
dav1312 marked this pull request as ready for review January 11, 2026 19:55
@dav1312 dav1312 changed the title Add visual aids in analysis board [RFC] Add visual aids in analysis board Jan 11, 2026
@dav1312

dav1312 commented Jan 12, 2026

Copy link
Copy Markdown
Contributor Author

I wanted to add safe zones and danger zones in the future in the same category of options.
Would "motif" still be a valid name for this?

image

ornicar and others added 2 commits January 12, 2026 10:09
because unprompted changes make people lose their mind
@ornicar
ornicar merged commit f3360a1 into lichess-org:master Jan 12, 2026
12 checks passed
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.

2 participants