}
// (Anti)King flags at 1 (true) if they can knight-jump
setFlags(fenflags) {
this.kingFlags = { w: {}, b: {} };
}
// (Anti)King flags at 1 (true) if they can knight-jump
setFlags(fenflags) {
this.kingFlags = { w: {}, b: {} };
- for (let i=0; i<fenFlags.length; i++) {
- const white = fenFlags.charCodeAt(i) <= 90;
- const curChar = fenFlags.charCodeAt(i).toLowerCase();
+ for (let i=0; i<fenflags.length; i++) {
+ const white = fenflags.charCodeAt(i) <= 90;
+ const curChar = fenflags.charAt(i).toLowerCase();
- Array.prototype.concat.apply(
- ['w', 'b'].map(c => Object.keys(this.kingFlags[c]))
+ Array.prototype.concat.apply([],
+ ['w', 'b'].map(c => {
+ const res = Object.keys(this.kingFlags[c]).join("");
+ return (c == 'w' ? res.toUpperCase() : res);
+ })
getPotentialMovesFrom([x, y]) {
const color = this.turn;
let moves = super.getPotentialMovesFrom([x, y]);
getPotentialMovesFrom([x, y]) {
const color = this.turn;
let moves = super.getPotentialMovesFrom([x, y]);
// Allow knight jump (king or antiking)
const knightMoves = super.getPotentialMovesOf('n', [x, y]);
// Remove captures (TODO: could be done more efficiently...)
// Allow knight jump (king or antiking)
const knightMoves = super.getPotentialMovesOf('n', [x, y]);
// Remove captures (TODO: could be done more efficiently...)