Massive exchange leaves black ahead

Details

Author:Mark
Rating:
Difficulty:Beginner
Date:13th December 2020
Description:It's blacks turn, and after a massive exchange of pieces black will find themselves ahead by a bishop.

Code

//Please feel welcome to copy this code for your own creations.
blackAtTop(false);
whitesTurn(false);

fromFen("5bk1/2Br1p2/p1qPp1p1/7p/3RQP1P/6P1/P2R3K/2r5 b - - 0 1");
info("It's blacks turn, and they can end up ahead, can you find out how?");

let steps = ["Qxe4", "Rxe4", "Rcxc7", "dxc7", "Rxd2+"];

onPieceClicked(function(squareName) {
    unhighlightAll();
    
    if(squareName == sourceOfSan(steps[0])) {
        return true;
    } else {
        highlightSquareRed(squareName);
        return false;
    }
});

onMoveAttempted(function(san) {
    if(san == steps[0]) {
        steps.shift();
        
        if(steps.length > 0) {
          setTimeout(function() {
            performMove(steps[0]);
            steps.shift();
          }, 500);
        } else {
          complete();
          info(" ");
        }

        return true;
    } else {
        return false;
    }
});