A deep copy, safe to mutate (via applyMove) without touching the original - what legalMoves uses to try a move and check it does not leave the mover in check.
applyMove
legalMoves
import { startingChess, cloneChess } from '@datamoc/mw_games/board';const state = startingChess();const trial = cloneChess(state);console.log(trial !== state, trial.turn); // true 'white' Copy
import { startingChess, cloneChess } from '@datamoc/mw_games/board';const state = startingChess();const trial = cloneChess(state);console.log(trial !== state, trial.turn); // true 'white'
A deep copy, safe to mutate (via
applyMove) without touching the original - whatlegalMovesuses to try a move and check it does not leave the mover in check.