French Defense Trainer
Details
Author: | Mark |
Rating: | |
Difficulty: | Beginner |
Date: | 5th February 2021 |
Description: | A trainer to help you learn and memorize the major variations of the French Defense. |
Code
let root = [
"e4",
"e6",
{
"info": "This is the French Defense"
},
[
"Nc3",
{
"info": "This is the Queen's Knight"
},
"d5",
"f4",
{
"info": "This is the Queen's Knight (Pelikán)"
}
],
[
"b3",
{
"info": "This is the Réti Gambit"
}
],
[
"c4",
{
"info": "This is the Steiner Variation"
},
"d5",
"cxd5",
"exd5",
"Qb3",
{
"info": "This is the Steiner, Orthoschnapp Gambit"
}
],
[
"Qe2",
{
"info": "This is the Chigorin Attack"
}
],
[
"d3",
{
"info": "This is the Hanham Variation"
},
"d5",
"Nd2",
"Nf6",
"Ngf3",
"Nc6",
"Be2",
{
"info": "This is the Reversed Philidor"
}
],
[
"d4",
{
"info": "This is the main line"
},
[
"a6",
{
"info": "This is the St. George Defense"
},
"c4",
"b5",
"cxb5",
"axb5",
"Bxb5",
{
"info": "This is the St. George Gambit"
}
],
[
"c5",
{
"info": "This is the Franco-Benoni Defense"
}
],
[
"d6",
{
"info": "This is the Lengfellner System"
}
],
[
"d5",
[
"Nd2",
{
"info": "This is the Tarrasch Variation"
},
[
"Nc6",
{
"info": "This is the Guimard Variation"
},
"Ngf3",
"Nf6",
{
"info": "This is the Byrne Variation"
}
],
[
"c5",
{
"info": "This is the Open Tarrasch"
},
"exd5",
[
"Nf6",
{
"info": "This is the Shaposhnikov Gambit"
}
],
[
"Qxd5",
"Ngf3",
"cxd4",
"Bc4",
"Qd8",
{
"info": "This is the Eliskases Variation"
}
],
[
"exd5",
{
"info": "This is the Exchange Variation"
},
"Ngf3",
"Nc6"
]
],
[
"f5",
{
"info": "This is the Haberditz Variation"
}
],
[
"Nf6",
{
"info": "This is the Closed Tarrasch"
},
"e5",
"Nfd7",
[
"f4",
{
"info": "This is the Pawn Center Variation"
},
"c5",
"c3",
"Nc6",
"Ndf3",
"cxd4",
"cxd4",
"Nb6",
{
"info": "This is the Leningrad Variation"
}
],
[
"Bd3",
"c5",
"c3",
[
"b6",
{
"info": "This is the Botvinnik Variation"
}
],
[
"Nc6",
"Ne2",
"cxd4",
{
"info": "This is the Closed Tarrasch"
},
"cxd4",
"Nb6",
{
"info": "This is the Closed Tarrasch (Russian)"
}
]
]
]
],
[
"Bd3",
{
"info": "This is the Schlechter Variation"
}
],
[
"Be3",
{
"info": "This is the Alapin Gambit"
}
],
[
"exd5",
{
"info": "This is the Exchange Variation"
},
"exd5",
"Nc3",
[
"Bb4",
"Bd3",
"Ne7",
{
"info": "This is the Canal Attack"
}
],
[
"Nf6",
{
"info": "This is the Svenonius Variation"
},
"Bg5",
"Nc6",
{
"info": "This is the Bogolyubov Variation"
}
]
],
[
"e5",
{
"info": "This is the Advance Variation"
},
[
"Bd7",
{
"info": "This is the Bishop Swap Variation"
}
],
[
"c5",
[
"dxc5",
{
"info": "This is the Advance, Steinitz Variation"
}
],
[
"Qg4",
{
"info": "This is the Nimzovich Attack"
},
"cxd4",
"Nf3",
{
"info": "This is the Nimzovich Gambit"
}
],
[
"Nf3",
{
"info": "This is the Nimzovich System"
}
],
[
"c3",
[
"Qb6",
"Nf3",
"Bd7",
{
"info": "This is the Wade Variation"
}
],
[
"Nc6",
"Nf3",
{
"info": "This is the Paulsen Attack"
},
[
"Bd7",
{
"info": "This is the Euwe Variation"
}
],
[
"Qb6",
"Bd3",
{
"info": "This is the Milner-Barry Gambit"
}
]
]
]
]
],
[
"Nc3",
{
"info": "This is the Paulsen Variation"
},
[
"c5",
{
"info": "This is the Marshall Gambit"
}
],
[
"dxe4",
{
"info": "This is the Rubinstein Variation"
},
"Nxe4",
[
"Qd5",
{
"info": "This is the Frere (Becker) Variation"
}
],
[
"Bd7",
"Nf3",
[
"Bc6",
{
"info": "This is the Fort Knox Variation"
}
],
[
"Ngf6",
{
"info": "This is the Capablanca Line"
}
]
]
],
[
"Nf6",
[
"Be3",
{
"info": "This is the Henneberger Variation"
}
],
[
"exd5",
{
"info": "This is the Svenonius Variation"
}
],
[
"Bd3",
{
"info": "This is the Swiss Variation"
}
],
[
"Bg5",
[
"dxe4",
{
"info": "This is the Burn Variation"
}
],
[
"Bb4",
{
"info": "This is the MacCutcheon Variation"
},
[
"exd5",
"Qxd5",
"Bxf6",
"gxf6",
"Qd2",
"Qa5",
{
"info": "This is the MacCutcheon, Bogolyubo Variation)"
}
],
[
"e5",
{
"info": "This is the MacCutcheon, Advance Variation"
},
"h6",
[
"exf6",
{
"info": "This is the MacCutcheon, Chigorin Variation"
},
"hxg5",
"fxg7",
"Rg8",
"h4",
"gxh4",
"Qg4",
{
"info": "This is the MacCutcheon, Grigoriev Variation"
}
],
[
"Bc1",
{
"info": "This is the MacCutcheon, Dr. Olland Variation"
}
],
[
"Bh4",
{
"info": "This is the MacCutcheon, Bernstein Variation"
}
],
[
"Be3",
{
"info": "This is the MacCutcheon, Janowski Variation"
}
],
[
"Bd2",
{
"info": "This is the MacCutcheon, Lasker Variation"
},
[
"Nfd7",
{
"info": "This is the MacCutcheon, Tartakower Variation"
}
],
[
"Bxc3",
"bxc3",
"Ne4",
"Qg4",
"Kf8",
"Bc1",
{
"info": "This is the MacCutcheon, Duras Variation"
}
]
]
]
],
[
"Be7",
{
"info": "This is the Classical Variation"
},
[
"Bxf6",
{
"info": "This is the Classical, Anderssen Variation"
},
"Bxf6",
"e5",
"Be7",
"Qg4",
{
"info": "This is the Classical, Richter Attack"
}
],
[
"e5",
[
"Ng8",
{
"info": "This is the Classical (Vistaneskis)"
},
"Be3",
"b6",
{
"info": "This is the Classical, Frankfurt Variation"
}
],
[
"Ne4",
{
"info": "This is the Classical, Tartakower Variation"
}
],
[
"Nfd7",
[
"h4",
{
"info": "This is the Albin Countergambit"
},
[
"f6",
{
"info": "This is the Albin-Alekhine-Chatard attack, Teichmann Variation"
}
],
[
"c5",
{
"info": "This is the Albin-Alekhine-Chatard attack, Breyer Variation"
}
],
[
"0-0",
{
"info": "This is the Albin-Alekhine-Chatard attack, Spielmann Variation"
}
],
[
"a6",
{
"info": "This is the Albin-Alekhine-Chatard attack, Maróczy Variation"
}
]
],
[
"Bxe7",
{
"info": "This is the Classical line"
},
"Qxe7",
[
"Qd2",
{
"info": "This is the Classical, Rubinstein Variation"
},
"0-0",
"f4",
"c5",
"Nf3",
"10",
{
"info": "This is the Classical, Ståhlberg Variation"
}
],
[
"Qg4",
{
"info": "This is the Classical, Pollock Variation"
}
],
[
"Bd3",
{
"info": "This is the Classical, Tarrasch Variation"
}
],
[
"Nb5",
{
"info": "This is the Classical, Alapin Variation"
}
],
[
"f4",
{
"info": "This is the Classical, Steinitz Variation"
}
]
]
]
]
]
],
[
"e5",
{
"info": "This is the Steinitz Variation"
},
"Nfd7",
[
"Qg4",
{
"info": "This is the Steinitz, Gledhill Attack"
}
],
[
"f4",
"c5",
[
"dxc5",
[
"Bxc5",
"Qg4",
{
"info": "This is the Steinitz, Bradford Attack"
}
],
[
"Nc6",
"a3",
"Bxc5",
"Qg4",
"0-0",
"Nf3",
"f6",
{
"info": "This is the Steinitz, Brodsky-Jones Variation"
}
]
],
[
"Nf3",
"Nc6",
"Be3",
{
"info": "This is the Steinitz, Boleslavsky Variation"
}
]
]
]
],
[
"Bb4",
{
"info": "This is the Winawer Variation"
},
[
"Bd2",
{
"info": "This is the Winawer, Fingerslip Variation"
}
],
[
"Bd3",
"c5",
"exd5",
"Qxd5",
"Bd2",
{
"info": "This is the Winawer, Kondratiev Variation"
}
],
[
"Nge2",
{
"info": "This is the Winawer, Maróczy Variation"
},
"dxe4",
"a3",
[
"Be7",
"Nxe4",
[
"Nf6",
"N2g3",
"0-0",
"Be2",
"Nc6",
{
"info": "This is the Winawer, Alekhine Gambit, Alatortsev Variation"
}
],
[
"Nc6",
"g4",
{
"info": "This is the Winawer, Alekhine Gambit"
}
]
],
[
"Bxc3+",
{
"info": "This is the Winawer, Alekhine Gambit"
},
"Nxc3",
"Nc6",
{
"info": "This is the Winawer, Kan Variation"
}
]
],
[
"e5",
{
"info": "This is the Winawer, Advance Variation"
},
[
"Qd7",
{
"info": "This is the Winawer, Advance, Petrosian Variation"
}
],
[
"c5",
[
"Qg4",
{
"info": "This is the Winawer, Advance, Russian Variation"
}
],
[
"Bd2",
{
"info": "This is the Winawer, Advance, Bogolyubov Variation"
}
],
[
"a3",
[
"Ba5",
"b4",
"cxd4",
{
"info": "This is the Winawer, Advance, Retreat Variation, Armenian Line"
}
],
[
"cxd4",
"axb4",
"dxc3",
"Nf3",
{
"info": "This is the Winawer, Advance, Rauzer Variation"
}
],
[
"Bxc3+",
"bxc3",
[
"Qc7",
{
"info": "This is the Winawer, Advance, Classical Variation"
}
],
[
"Ne7",
[
"Qg4",
{
"info": "This is the Winawer, Advance, Poisoned Pawn Variation"
},
"Qc7",
"Qxg7",
"Rg8",
"Qxh7",
"cxd4",
[
"Kd1",
{
"info": "This is the Winawer, Advance, Euwe Variation"
}
],
[
"Ne2",
{
"info": "This is the Winawer, Advance, Konstantinopolsky Variation"
}
]
],
[
"Nf3",
"e4",
"e6",
"d4",
"d5",
"Nc3",
"Bb4",
"e5",
"c5",
"a3",
"Bxc3+",
"bxc3",
"Ne7",
"a4",
{
"info": "This is the Winawer, Advance, Smyslov Variation"
}
]
]
]
]
]
]
]
]
]
],
[
"e5",
{
"info": "This is the Steinitz Attack"
}
],
[
"Bb5",
{
"info": "This is the Bird Invitation"
}
],
[
"f4",
{
"info": "This is the Labourdonnais Variation"
}
],
[
"Nf3",
{
"info": "This is the King's Knight Variation"
},
"d5",
[
"e5",
"c5",
"b4",
{
"info": "This is the King's Knight, Wing Gambit"
}
],
[
"Nc3",
{
"info": "This is the Two Knights Variation"
}
]
],
[
"g3",
{
"info": "This is the Reti-Spielmann attack"
}
]
];
let targetMove = "";
onPieceClicked(function (squareName) {
if (typeof targetMove == "string") {
if (squareName == sourceOfSan(targetMove)) {
return true;
}
} else if (Array.isArray(targetMove)) {
for (let temp of targetMove) {
if (squareName == sourceOfSan(temp)) {
return true;
}
}
} else {
throw new Error();
}
if (targetMove == "") {
return false;
}
if (squareName == sourceOfSan(targetMove)) {
return true;
}
highlightSquareRed(squareName);
return false;
});
onMoveAttempted(function (san) {
if (typeof targetMove == "string") {
if (san == targetMove) {
current.index++;
setTimeout(next, 50);
return true;
}
} else if (Array.isArray(targetMove)) {
for (let temp of targetMove) {
if (san == temp) {
for (let i = current.index; i < current.length; i++) {
if (current[i][0] == san) {
current[i].parent = current;
current = current[i];
current.index = 1;
break;
}
}
setTimeout(next, 50);
return true;
}
}
} else {
throw new Error();
}
return false;
});
onNextClicked(function () {
showNextButton(false);
next();
});
function nextDelayed() {
setTimeout(next, 500);
}
function onUndoClicked() {
undo();
if (current.index > 0) {
current.index--;
if (current.index > 0 && current[current.index].info != undefined) {
current.index--;
}
}
if (current.index == 0) {
if (current.parent != undefined) {
current = current.parent;
} else {
//showButton("undo", false);
}
}
next();
}
let current = root;
current.index = 0;
let preInfo = "";
let flipped = false;
createButton("Flip", function () {
blackAtTop(flipped);
flipped = !flipped;
});
createButton("Undo", onUndoClicked);
showButton("Undo", false);
let undoButtonVisible = false;
function next() {
let showUndoButton = current != root || current.index > 0;
if (undoButtonVisible != showUndoButton) {
showButton("Undo", showUndoButton);
undoButtonVisible = showUndoButton;
}
if (preInfo != "") {
preInfo += "<br><br>";
}
if (current.index >= current.length) {
info(preInfo + "End of the line");
preInfo = "";
return;
}
let step = current[current.index];
if (typeof step == "string") {
if (isWhitesTurn()) {
info(preInfo + "White to play <b>" + currentMoveNumber() + "." + step + "</b>");
} else {
info(preInfo + "Black to play <b>" + currentMoveNumber() + "..." + step + "</b>");
}
targetMove = step;
preInfo = "";
} else if (Array.isArray(step)) {
///assume that the rest of the steps in the current array are also arrays
//i.e. different options from this point
let possibleSteps = [];
for (let i = current.index; i < current.length; i++) {
//assume that the first step in every array is a string
//otherwise it would be seperated out into an array at the previous level
possibleSteps.push(current[i][0]);
}
targetMove = possibleSteps;
if (isWhitesTurn()) {
possibleSteps = possibleSteps.map(x => "<li><b>" + currentMoveNumber() + "." + x + "</b></li>");
info(preInfo + "White can play: <ul>" + possibleSteps.join("") + "</ul>");
} else {
possibleSteps = possibleSteps.map(x => "<li><b>" + currentMoveNumber() + "..." + x + "</b></li>");
info(preInfo + "Black can play: <ul>" + possibleSteps.join("") + "</ul>");
}
preInfo = "";
} else {
if (step.info != undefined) {
preInfo = step.info;
current.index++;
next();
}
}
}
next();