canIplay(side, [x,y])
{
- return ((side=='w' && this.moves.length%2==0) || (side=='b' && this.moves.length%2==1))
+ return ((side=='w' && this.moves.length%2==0)
+ || (side=='b' && this.moves.length%2==1))
&& [side,'c'].includes(this.getColor(x,y));
}
this.play(move);
const color = this.turn;
this.moves.push(move); //artifically change turn, for checkered pawns (TODO)
- const kingAttacked = this.isAttacked(this.kingPos[color], [this.getOppCol(color),'c']);
+ const kingAttacked = this.isAttacked(
+ this.kingPos[color], [this.getOppCol(color),'c']);
let res = kingAttacked
? [ JSON.parse(JSON.stringify(this.kingPos[color])) ] //need to duplicate!
: [ ];
{
// Capture
let startColumn = String.fromCharCode(97 + move.start.y);
- notation = startColumn + "x" + finalSquare + "=" + move.appear[0].p.toUpperCase();
+ notation = startColumn + "x" + finalSquare +
+ "=" + move.appear[0].p.toUpperCase();
}
else //no capture
+ {
notation = finalSquare;
- if (move.appear.length > 0 && piece != move.appear[0].p) //promotion
- notation += "=" + move.appear[0].p.toUpperCase();
+ if (move.appear.length > 0 && piece != move.appear[0].p) //promotion
+ notation += "=" + move.appear[0].p.toUpperCase();
+ }
return notation;
}