this.newGame("computer");
},
newGame: function(mode, fenInit, color, oppId, moves, continuation) {
- const fen = fenInit || VariantRules.GenRandInitFen();
+ const fen = "pppppppp/rnbqkbnr/8/8/8/8/PPPPPPPP/ROBQKBOR 1111"; //fenInit || VariantRules.GenRandInitFen();
console.log(fen); //DEBUG
this.score = "*";
if (mode=="human" && !oppId)
return false;
}
}
- m.appear.forEach(psq => {
- if (Object.keys(VariantRules.ALICE_CODES).includes(psq.p))
+ // If the move is computed on board1, m.appear change for Alice pieces.
+ if (mirrorSide==1)
+ {
+ m.appear.forEach(psq => { //forEach: castling taken into account
psq.p = VariantRules.ALICE_CODES[psq.p]; //goto board2
- else
- psq.p = VariantRules.ALICE_PIECES[psq.p]; //goto board1
- });
+ });
+ }
+ else //move on board2: mark vanishing piece as Alice
+ m.vanish[0].p = VariantRules.ALICE_CODES[m.vanish[0].p]
return true;
});
}
// Scan move for pawn (max 1) on 8th rank
for (let i=1; i<move.appear.length; i++)
{
- if (move.appear[i].p==V.PAWN && move.appear[i].x==lastRank)
+ if (move.appear[i].p==V.PAWN && move.appear[i].c==color && move.appear[i].x==lastRank)
{
move.appear[i].p = V.ROOK;
moves.push(move);