pacosako icon indicating copy to clipboard operation
pacosako copied to clipboard

Rollback of chain should not roll back start of move promotion

Open kreibaum opened this issue 2 years ago • 1 comments

Yorick reported on WhatsApp

kreibaum avatar Oct 13 '22 13:10 kreibaum

This is even stranger. When your turn starts and you get to promote at the start, then the button to rollback is available. It should not be available and it correctly does nothing.

After you have promoted, the button could arguably be available (It is your time after all so why not do a different decision) - But it is not available.

Now after you lift a piece, the option becomes available and fully rolls back your move including the promotion at the start.

kreibaum avatar Oct 16 '22 18:10 kreibaum

I tried to fix this by pushing the "Required Action" into the current match state. And then I wanted to derive it from that.

That still doesn't allow me do differentiate between "Your turn started, Lift a piece" and "You just promoted and now get to lift". Only in the second position is a rollback allowed.

It seems like Rollback behaves like a "Legal Action" so I should try to derive it in client JavaScript instead.

kreibaum avatar Jul 18 '24 06:07 kreibaum

Elm Side: LegalActionsResponse

Rust (Wasm) Side: LegalActionsDeterminedData

kreibaum avatar Jul 18 '24 06:07 kreibaum

Happy with the state I have with the bf2b7acd9c5c557191da5db8b6d8f59e87779f95 commit. The button now uses library logic (wasm) and shows up exactly when a rollback would do something. If I change library logic in the future, the frontend will adapt :-)

kreibaum avatar Jul 19 '24 12:07 kreibaum