Skewers enable us to capture opponents pieces by attacking multiple pieces at the same time. They are often described as 'reverse pins' as they directly attack the most valuable piece.
Code
//Please feel welcome to copy this code for your own creations.
fromFen("5k1r/p1p3pp/2bp1p1q/2n1p3/2P1P3/B1NP4/P1P1QPPP/1R3RK1 w k - 0 1");
let steps = [];
let targetMove = "";
steps.push(function() {
info("Skewers are similar to pins, except in reverse.\
<br>A skewer threatens a valuable piece, forcing it to move, and exposing another piece to attack.\
<br>Play Rb8+ to skewer the opponent's king and rook.");
targetMove = "Rb8+";
});
steps.push(function() {
performMove("Kf7");
nextDelayed();
});
steps.push(function() {
info("You are now free to take the opponent's rook.");
targetMove = "Rxh8";
});
steps.push(function() {
info("Correct!");
showNextButton(true);
});
steps.push(function() {
fromFen("2Q5/1p4q1/p4k2/6p1/P3b3/6BP/5PP1/6K1 w - - 0 1");
info("In \"Nigel Short vs. Rafael Vaganian, Barcelona World Cup (1989)\" skewers are used to capture the black queen.\
<br>First we use our bishop to skewer the king and queen.");
targetMove = "Be5+";
});
steps.push(function() {
performMove("Kxe5");
nextDelayed();
});
steps.push(function() {
info("Now that the black king is not defending the queen anymore, we can skewer it with our queen");
targetMove = "Qc3+";
});
steps.push(function() {
performMove("Kf5");
nextDelayed();
});
steps.push(function() {
targetMove = "Qxg7";
});
steps.push(function() {
info("Correct!");
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();