lichess.org
Donate

[Feature request] Using keyboard for selecting pieces

Or maybe with the keyboard it could be this way:
1. We have a premove.
2. The program remembers the position on the board as if the premove was already executed.
3. Then we press Ctrl and hover our mouse over final destination of the second premove, click a key for moving this piece (if it's pawn e2e4, we hover mouse over e4 square and click "W"). Then the program just remembers it, and through the userscript both square get highlighted in red (maybe of different shades).
4. If we unpress Ctrl, premove cancels.
5. Right after the first premove is executed, the program makes the second one just as if it would do the first.
6. Then we can make unlimited premoves, highlighted each in different colors, by pressing new keys (Ctrl, Shift, etc.).
This is really incredible. Quick comment -- I think it's a bit clumsy to map Knight to "N" given that it's on the same side of the keyboard as my mouse (so I have to lift my hand up from my mouse to trigger it). Might me better to bind knight to "Ctrl + " the directional key.
@Flourish, you can easily change keys assignments in tampermonkey. For example, you can make "~" for knights. Just go to the end of the code, and you'll find shortcuts there ( bindMove("v",nmoves,"knight",1);).
Updated, same url as before: gist.github.com/Vempele/46333e85e33b6d488c3ffb131942272d

Multipremove is implemented but disabled by default (see the variables at the top of the script).

I STRONGLY RECOMMEND AGAINST USING MULTIPREMOVE IN RATED GAMES AT THIS TIME. When I asked on discord if it was okay to implement it, thibault said yes, but that "lichess might detect it as cheat".

To multipremove (once you've enabled it), simply make keyboard moves as normal (or you can set multiWithoutShift=false to require that the shift key be held while making multipremoves). Note that attempting to make an ambiguous knight move will cancel your multipremoves (as it'll unavoidably cancel your normal premove as well).

Multipremoves are highlighted with green arrows.

Clicking anywhere on the board cancels all multipremoves; pressing Esc cancels the Lichess premove in addition to the multipremoves.

Multipremove for piece drops isn't implemented.

Other than multipremove, I think the only functional change is that it now works in RK games if there's a clock.

Still only tested in Chrome.

@Chesstroll_Ingot @Flourish
Known issue: while it'll work for solving puzzles, you can't make keyboard moves for the opponent when analyzing the puzzle afterwards as it fails to detect the side to move. Will probably be fixed in the next version.
@Vempele, maybe a good idea would be to add disambiguation for two pieces which can go to the same square. It's possible to do this: SetAttribute "firstknight" and "secondknight" for different knight, and then to add a mark for one or both knights to distinguish them. It may be a color, or a number. I can create a set of pieces with marks in Illustrator, if you would like this idea. For example, one knight would have "C" (or maybe better some color) painted on it. And we can access it with "Ctrl" (or any different variation). But if there are only one knight, which can go to the square, then we can use either a key with "Ctrl" or without.
I think it'd be best if there were one key that only worked for unique knight moves and two other keys for the specific knights. The thing is, if you're used to pressing a certain key in the unique case you'll still instinctively press it even when multiple knights can move to square regardless of which knight you're trying to move: you're so focused on the knight you intend to move that you may fail to notice that the other knight can also go to the same square.

I speak from experience: I've hung several knights on FICS where my system was "N" for:
1. Unique knight
2. Forward-moving knight (if there's only one)
3. Home-rank knight (e.g. you've played Nbd7 and you now "obviously" want to play Ngf6)
(Other non-unique moves had to be made with the mouse)

For example, one time I had knights on b8 and f6, and my opponent had just played e5.

On highlights: I could code it so that it only highlights the knights when you're hovering over a square they can move to.
Yes, maybe one button for unique knights, and two buttons for different knights. This is an example, how we could distinguish knights. One knight can have some special image:
i.snag.gy/5RPflm.jpg.

Also would be helpful to have disambiguation for rooks. For example, I had a case, where one my rook was on f8 and there were many pawns between f8 and f1, and I tried to move f1 with another rook, but it also only selects them, even though it's impossible for the rook on f8 to move to f1.

This topic has been archived and can no longer be replied to.