Introduction to deflections

Details

Author:Mark
Rating:
Difficulty:Beginner
Date:28th January 2021
Description:A deflection is when you force a piece to move off it's square, often exposing another piece for attack. Find a move that forces the king to stop protecting his queen.

Code

fromFen("rnbqkb1r/pp2nppp/8/2p1P3/2B5/4P3/PP3PPP/RNBQK1NR w KQkq - 0 6");

let steps = [];
let targetMove = "";

steps.push(function() {
    info("A deflection is when you force a piece to move off it's square, often exposing another piece for attack.\
    <br>Find a move that forces the king to stop protecting his queen.");
    targetMove = "Bxf7+";
});

steps.push(function() {
    performMove("Kxf7");
    nextDelayed();
});


steps.push(function() {
    info("Now you are free to capture the queen!");
    targetMove = "Qxd8";
});

steps.push(function() {
    info("Congratulations!");
    showNextButton(true);
});

steps.push(function() {
    fromFen("r4rk1/pqp2ppp/1p1n4/1b6/8/1N3Q1P/PPP1BPP1/R4RK1 w Qq - 0 1");

    info("Deflections often occur when a piece is overworked, i.e. it is performing two jobs.\
    Try Playing <b>Qxb7</b>");
    targetMove = "Qxb7";
});

steps.push(function() {
    performMove("Nxb7");
    nextDelayed();
});

steps.push(function() {
    info("Now we are free to take the bishop!");
    targetMove = "Bxb5";
});

steps.push(function() {
    info("Congratulations!");
    showNextButton(true);
});

steps.push(function() {
    
    fromFen("2r1r1k1/1p1q1ppp/3p1b2/p2P4/3Q4/5N2/PP2RPPP/4R1K1 w - - 0 1");
   
    info("Let's review a famous game: Edwin Ziegler Adams vs Carlos Torre Repetto, New Orleans (1920)\
    <br>Black is vulnerable to a back rank mate, but first we have to get his queen out the way\
    <br>Play <b>Qg4</b>");
    
    targetMove = "Qg4";
});

steps.push(function() {
    performMove("Qb5");
    nextDelayed();
});

steps.push(function() {
    info("Play <b>Qc4</b>, if Black tries to capture with either their queen or rook then we can checkmate.");
    targetMove = "Qc4";
});

steps.push(function() {
    performMove("Qd7");
    nextDelayed();
});

steps.push(function() {
    info("Play <b>Qc7</b>, Keep chasing the queen.");
    targetMove = "Qc7";
});

steps.push(function() {
    performMove("Qb5");
    nextDelayed();
});

steps.push(function() {
    info("Play <b>a4</b> to bring his queen to the 4th rank");
    targetMove = "a4";
});

steps.push(function() {
    performMove("Qxa4");
    nextDelayed();
});

steps.push(function() {
    info("Play <b>Re4</b> to attack the queen again.");
    targetMove = "Re4";
});

steps.push(function() {
    performMove("Qxe4");
    nextDelayed();
});

steps.push(function() {
    info("Now you are free to capture the queen!");
    targetMove = "Rxe4";
});

steps.push(function() {
    info("");
    complete();
});

onPieceClicked(function (squareName) {
    if(targetMove == "") {
        return false;
    }

    if (squareName == sourceOfSan(targetMove)) {
        return true;
    } else {
        highlightSquareRed(squareName);
        return false;
    }
});

onMoveAttempted(function (san) {
    if (targetMove != "" && san == targetMove) {
        nextDelayed();
        targetMove = "";
        return true;
    } else {
        return false;
    }
});

onNextClicked(function () {
    showNextButton(false);
    next();
});

function nextDelayed() {
    setTimeout(next, 400);
}

function next() {
    if (steps.length > 0) {
        //remove the first function from the array and call it
        steps.shift()();
    }
}

next();