Live data from Hacker News

What happens when you make a move in lichess.org?

davidreis.me

1–10 of 162 posts

Re: What happens when you make a move in lichess.org?

#2
- "While these moves could be calculated client-side, providing them server-side ensures consistency - especially for complex or esoteric chess variants - and optimizes performance on clients with limited processing capabilities or energy restrictions."

Just a wild guess: might be intended to lower the implementation barrier for new open-source software clients on new platforms, and/or preempt them from implementing subtle logic bugs that only show up much later.

The rules of chess are a bit tedious to implement, and you can easily get tired and code an edge-case bug that's almost invisible. Lichess itself did this—it once had a logic error that affected a very tiny number (exactly 7) of games,

https://github.com/lichess-org/database/issues/23 ("Before 2015: Some games with illegal moves were recorded")

(I apologize I couldn't find the specific patch that fixed this)

Re: What happens when you make a move in lichess.org?

#5

- "While these moves could be calculated client-side, providing them server-side ensures consistency - especially for complex or esoteric chess variants - and optimizes performance on clients with limited processing capabilities or energy restrictions." Just a wild guess: might be intended to lower the implementation barrier for new open-source software clients on new platforms, and/or preempt them from implementing…

> and/or preempt them from implementing subtle logic bugs that only show up much later.

Validating a submitted move is distinct from listing valid moves. I assumed the server would need to validate regardless of providing a list to the client.

Re: What happens when you make a move in lichess.org?

#6
post #5

- "While these moves could be calculated client-side, providing them server-side ensures consistency - especially for complex or esoteric chess variants - and optimizes performance on clients with limited processing capabilities or energy restrictions." Just a wild guess: might be intended to lower the implementation barrier for new open-source software clients on new platforms, and/or preempt them from implementing…

> and/or preempt them from implementing subtle logic bugs that only show up much later. Validating a submitted move is distinct from listing valid moves. I assumed the server would need to validate regardless of providing a list to the client.

It's still duplicated work, and clients are likely to get it wrong and create more work for both devs.

Re: What happens when you make a move in lichess.org?

#8

what happens to those websocket connections when the API is updated or redeployed?

It is to be expected that LLM will make a decision on its own if it suspects any changes to the API. In any case, there is no time to fix the code during the game.

Re: What happens when you make a move in lichess.org?

#9

I wish the article explained how it dealt with message loss from the at-most-once redis pub/sub channel

Indeed, it does deal with the message loss. I was momentarily confused because in my many thousands of bullet chess games on Lichess I haven't had much of any message loss that can be attributed to Lichess's servers (but plenty when my Internet connection is down or unstable).

I will have to take a look, because whatever it's doing, it works very well!

Re: What happens when you make a move in lichess.org?

#10

- "While these moves could be calculated client-side, providing them server-side ensures consistency - especially for complex or esoteric chess variants - and optimizes performance on clients with limited processing capabilities or energy restrictions." Just a wild guess: might be intended to lower the implementation barrier for new open-source software clients on new platforms, and/or preempt them from implementing…

For those curious about the illegal move, it seems like it's allowing queen side castling through the king side rook (or vice versa). eg. if this is the first rank, R _ _ R K _ _ _, then you could make the move O-O-O and end up with _ _ _ R K _ _ _

Naturally, it's not possible to view this move anymore, but this game (https://lichess.org/XDQeUk6j#48) has everything up until the last legal move right before the illegal castling happened.

Post reply on HN