- static GenRandInitFen() {
- return ChessRules.GenRandInitFen().replace(/ -$/, "");
+ static GenRandInitFen(randomness) {
+ return ChessRules.GenRandInitFen(randomness).slice(0, -2);
- if (this.getColor(i,j) == oppCol && this.isAttacked([i,j], [color]))
+ if (this.getColor(i,j) == oppCol && this.isAttacked([i,j], color))
if (om.start.x == sq[0] && om.start.y == sq[1])
// Piece moved:
sq = [om.appear[0].x, om.appear[0].y];
if (om.start.x == sq[0] && om.start.y == sq[1])
// Piece moved:
sq = [om.appear[0].x, om.appear[0].y];
delete attacked[origSq[0]+"_"+origSq[1]];
});
V.UndoOnBoard(this.board, om);
delete attacked[origSq[0]+"_"+origSq[1]];
});
V.UndoOnBoard(this.board, om);
// If this code is reached, rooks and king are on initial position
// Nothing on the path of the king ? (and no checks)
// If this code is reached, rooks and king are on initial position
// Nothing on the path of the king ? (and no checks)
// Nothing on final squares, except maybe king and castling rook?
for (i = 0; i < 2; i++) {
// Nothing on final squares, except maybe king and castling rook?
for (i = 0; i < 2; i++) {
if (em.start.x == attacked[0] && em.start.y == attacked[1])
// King moved:
sq = [em.appear[0].x, em.appear[0].y];
if (em.start.x == attacked[0] && em.start.y == attacked[1])
// King moved:
sq = [em.appear[0].x, em.appear[0].y];
// Did opponent king disappeared?
if (v.p == V.KING)
this.kingPos[this.turn] = [-1, -1];
// Or maybe a rook?
else if (v.p == V.ROOK) {
if (v.y < this.INIT_COL_KING[v.c])
// Did opponent king disappeared?
if (v.p == V.KING)
this.kingPos[this.turn] = [-1, -1];
// Or maybe a rook?
else if (v.p == V.ROOK) {
if (v.y < this.INIT_COL_KING[v.c])
}
getNotation(move) {
let notation = super.getNotation(move);
// Add a capture mark (not describing what is captured...):
if (move.vanish.length > 1 && move.appear.length == 1) {
}
getNotation(move) {
let notation = super.getNotation(move);
// Add a capture mark (not describing what is captured...):
if (move.vanish.length > 1 && move.appear.length == 1) {
// Pawn capture: remove initial "b" in bxc4 for example
notation = notation.substr(1);
notation = notation.replace("x","") + "X";
// Pawn capture: remove initial "b" in bxc4 for example
notation = notation.substr(1);
notation = notation.replace("x","") + "X";