chessground12
Version:
Extended lishuuro.org Chess UI
17 lines • 644 B
JavaScript
import { allPos, pos2key } from './util';
const wholeBoard = () => true;
export function predrop(pieces, piece, geom, variant) {
const color = piece.color;
// Pieces can be dropped anywhere on the board by default.
// Mobility will be modified based on variant and piece to match the game rule.
const mobility = wholeBoard;
switch (variant) {
default:
console.warn('Unknown drop variant', variant);
}
let keys = allPos(geom)
.filter(pos => pieces.get(pos2key(pos))?.color !== color && mobility(pos[0], pos[1]))
.map(pos2key);
return keys;
}
//# sourceMappingURL=predrop.js.map