if (this.movesCount <= 1) {
const firstRank = (this.movesCount == 0 ? 9 : 0);
const initDestFile = new Map([[1, 2], [7, 6]]);
- // Only option is knight / elephant swap:
- if (x == firstRank && !!initDestFile.get(y)) {
+ // Only option is knight --> elephant swap:
+ if (
+ x == firstRank &&
+ !!initDestFile.get(y) &&
+ this.getPiece(x, y) == V.KNIGHT
+ ) {
const destFile = initDestFile.get(y);
moves.push(
new Move({
const firstRank = (this.movesCount == 0 ? 9 : 0);
// TODO: initDestFile currently hardcoded for deterministic setup
const initDestFile = new Map([[1, 2], [8, 7]]);
- // Only option is knight / bishop swap:
- if (x == firstRank && !!initDestFile.get(y)) {
+ // Only option is knight --> bishop swap:
+ if (
+ x == firstRank &&
+ !!initDestFile.get(y) &&
+ this.getPiece(x, y) == V.KNIGHT
+ ) {
const destFile = initDestFile.get(y);
return [
new Move({