checkmate in 13

Details

Author:Mark
Rating:
Difficulty:Advanced
Date:8th January 2021
Description:It's white's turn, and they can checkmate in 13 half-moves.

Code

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

fromFen("4k2r/ppp2ppp/2n5/4p3/1b2q3/1B4PP/PPP2P2/R1B2K2 b Qk - 0 1");
info("It's white's turn, and they can checkmate in 13 half-moves.");

let steps = ["Qh1+", "Ke2", "Nd4+", "Kd3", "Qd1+", "Kc4", "a5", "Ba4+", "c6", "Bxc6+", "bxc6", "a3", "Qxc2#"];

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 {
        highlightSquareRed(destOfSan(san));
        return false;
    }
});