You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
state.movable.dests takes the Dests map, and it's possible to set custom piece movement rules by passing a custom map with .set(). However, state.premovable.dests takes Key[] and just stores the possible premove squares for a particular selected square. These values are calculated here
and are hardcoded to use the rules of chess (premove.ts). It's not possible to set custom premove squares like state.movable.dests using .set() or mutating cg.state directly because the rules of chess are automatically used in line 206 on every selection.
Solution
Make a new optional property state.premovable.customDests which uses the Dests format like state.movable.dests. When this property is present, it is used to set state.premovable.dests instead of calling premove() and using the rules of chess. To use custom premoves you can use .set() to set premovable.customDests.
The text was updated successfully, but these errors were encountered:
Problem
state.movable.dests
takes theDests
map, and it's possible to set custom piece movement rules by passing a custom map with.set()
. However,state.premovable.dests
takesKey[]
and just stores the possible premove squares for a particular selected square. These values are calculated herechessground/src/board.ts
Line 206 in 2397632
and are hardcoded to use the rules of chess (
premove.ts
). It's not possible to set custom premove squares likestate.movable.dests
using.set()
or mutatingcg.state
directly because the rules of chess are automatically used in line 206 on every selection.Solution
Make a new optional property
state.premovable.customDests
which uses theDests
format likestate.movable.dests
. When this property is present, it is used to setstate.premovable.dests
instead of callingpremove()
and using the rules of chess. To use custom premoves you can use.set()
to setpremovable.customDests
.The text was updated successfully, but these errors were encountered: