--- /dev/null
+#$# git-fat 9c52566d58ad295865614ad8cef9d7d1ce653a06 1929
--- /dev/null
+#$# git-fat 04326d5a5c48bd5cc09a0813fb4eaef356d65bec 58427
--- /dev/null
+#$# git-fat b6d42b75663feee7e82ecb25af460c2fb35856ac 86937
--- /dev/null
+#$# git-fat 6faf9fcf73eb1decace8e5b184584b7dee407474 61515
--- /dev/null
+#$# git-fat 5d1becd4ca9f78f23a31c9aff08445fa0049bfe9 83373
--- /dev/null
+#$# git-fat 9835efedfdf1ea4608f5a3e614805080a5626080 56194
--- /dev/null
+#$# git-fat efa009b523c9171675cdae9fd7efe5ab927474aa 76100
--- /dev/null
+#$# git-fat 3c7dbfb71ec750c22838bd9dcbe5439911740e5e 68704
--- /dev/null
+#$# git-fat c2ef9bd3b4d64fa70e457dbca6c6c137ecaf9fa6 3636
--- /dev/null
+#$# git-fat 133f69ee12f653f937c61df5b56622425748e5b1 59440
--- /dev/null
+#$# git-fat 0ffa52517f08bf09a72be978978168b57b8e88a6 2412
--- /dev/null
+#$# git-fat 801ab41f8ec97c1df188d2a51dce3547d3e8e1d6 82812
--- /dev/null
+#$# git-fat c05fd1d54fd9f810df6617d0c075f6cb4f444885 1282
--- /dev/null
+#$# git-fat dc2b64b09642ceacaa081f9d929cfc6cf2e08c5c 3262
--- /dev/null
+#$# git-fat a00737b9a9386590b0bff43defa54d2898f15842 1126
--- /dev/null
+#$# git-fat 020e7011f8189468b877bf8a2eaa28e4d8d35fad 36927
--- /dev/null
+#$# git-fat c42d884d03ab602eaaed93f9122956f12f927b1f 2727
--- /dev/null
+#$# git-fat 8fe31cc37dbcd20df8b0709bb5726ace486b0c52 63809
--- /dev/null
+#$# git-fat 35e1050c7d274c8ea0ee1344d0bbd2c30c460cd3 97525
--- /dev/null
+#$# git-fat c677edab8c0dde132cac60daacbab94da3f5fdc5 69790
--- /dev/null
+#$# git-fat 2d533c6fd5c39055daf54c0ab9c293854ed7cc09 89046
--- /dev/null
+#$# git-fat 93867ecc93215c19310e73107c3769d5a74a207a 81093
--- /dev/null
+#$# git-fat ea2c640c7e457290a91aa47e0a95571e7cca5d20 98557
--- /dev/null
+#$# git-fat 76c3a4bf8fc92ea846ee4cf1c10c1442a59641d9 73774
--- /dev/null
+#$# git-fat bc3cb320b359ac6bfaf255f42b53db5eeb5e5824 3187
--- /dev/null
+#$# git-fat 4cc90b50bdb09424a09fc09d184cebb240bbdcab 81539
--- /dev/null
+#$# git-fat 79b8998056839809721dd2b6553dea5234472d77 2841
--- /dev/null
+#$# git-fat 434f5e0b47e01f9571f8629fadcb05348ae7b673 100569
--- /dev/null
+#$# git-fat 538eede50c8d051294f736b27dd3ab1967f2eb76 1904
--- /dev/null
+#$# git-fat 5057d7628965459e86a1448549d7d69f89485399 4333
--- /dev/null
+#$# git-fat 829a06618eaa0e3fe0780f75657534cc45167b76 1321
--- /dev/null
+#$# git-fat 2ead14fd56360b53874674543b0c5732ad2e5c95 121829
return V.CanFlip;
}
+ static get IMAGE_EXTENSION() {
+ // All pieces should be in the SVG format
+ return ".svg";
+ }
+
// Turn "wb" into "B" (for FEN)
static board2fen(b) {
return b[0] == "w" ? b[1].toUpperCase() : b[1];
this.userColor,
this.score,
this.orientation) +
- ".svg"
+ V.IMAGE_EXTENSION
}
})
);
// No choices to show at first drawing
const squareWidth = boardElt.offsetWidth / sizeY;
const offset = [boardElt.offsetTop, boardElt.offsetLeft];
- // TODO: multi-rows if more than V.size.y pieces (as inEightpieces)
+ const maxNbeltsPerRow = Math.min(this.choices.length, sizeY);
+ let topOffset = offset[0] + (sizeY / 2) * squareWidth - squareWidth / 2;
+ let choicesHeight = squareWidth;
+ if (this.choices.length >= sizeY) {
+ // A second row is required (Eightpieces variant)
+ topOffset -= squareWidth / 2;
+ choicesHeight *= 2;
+ }
const choices = h(
"div",
{
attrs: { id: "choices" },
class: { row: true },
style: {
- top: offset[0] + (sizeY / 2) * squareWidth - squareWidth / 2 + "px",
+ top: topOffset + "px",
left:
offset[1] +
- (squareWidth * (sizeY - this.choices.length)) / 2 +
+ (squareWidth * Math.max(sizeY - this.choices.length, 0)) / 2 +
"px",
- width: this.choices.length * squareWidth + "px",
- height: squareWidth + "px"
+ width: (maxNbeltsPerRow * squareWidth) + "px",
+ height: choicesHeight + "px"
}
},
- this.choices.map(m => {
- // A "choice" is a move
- const applyMove = (e) => {
- e.stopPropagation();
- // Force a delay between move is shown and clicked
- // (otherwise a "double-click" bug might occur)
- if (Date.now() - this.clickTime < 200) return;
- this.play(m);
- this.choices = [];
- };
- const onClick =
- this.mobileBrowser
- ? { touchend: applyMove }
- : { mouseup: applyMove };
- return h(
- "div",
- {
- class: {
- board: true,
- ["board" + sizeY]: true
- },
- style: {
- width: 100 / this.choices.length + "%",
- "padding-bottom": 100 / this.choices.length + "%"
- }
- },
- [
- h("img", {
- attrs: {
- src:
- "/images/pieces/" +
- this.vr.getPPpath(
- m.appear[0].c + m.appear[0].p,
- // Extra arg useful for some variants:
- this.orientation) +
- ".svg"
+ [ h(
+ "div",
+ { },
+ this.choices.map(m => {
+ // A "choice" is a move
+ const applyMove = (e) => {
+ e.stopPropagation();
+ // Force a delay between move is shown and clicked
+ // (otherwise a "double-click" bug might occur)
+ if (Date.now() - this.clickTime < 200) return;
+ this.play(m);
+ this.choices = [];
+ };
+ const onClick =
+ this.mobileBrowser
+ ? { touchend: applyMove }
+ : { mouseup: applyMove };
+ return h(
+ "div",
+ {
+ class: {
+ board: true,
+ ["board" + sizeY]: true
},
- class: { "choice-piece": true },
- on: onClick
- })
- ]
- );
- })
+ style: {
+ width: (100 / maxNbeltsPerRow) + "%",
+ "padding-bottom": (100 / maxNbeltsPerRow) + "%"
+ }
+ },
+ [
+ h("img", {
+ attrs: {
+ src:
+ "/images/pieces/" +
+ this.vr.getPPpath(
+ m.appear[0].c + m.appear[0].p,
+ // Extra arg useful for some variants:
+ this.orientation) +
+ V.IMAGE_EXTENSION
+ },
+ class: { "choice-piece": true },
+ on: onClick
+ })
+ ]
+ );
+ })
+ ) ]
);
elementArray.unshift(choices);
}
p.boxed
- | TODO
+ | Three new pieces appear. All pieces are unique.
+
+p.
+ There are only one rook, one bishop and one knight per side in this variant.
+ That explains the name. The king and queen are still there,
+ and the three remaining slots are taken by new pieces:
+
+ul
+ li.
+ The lancer 'L' is oriented and can only move in the direction it points,
+ by any number of squares as long as an enemy isn't met
+ (it can jump over friendly pieces). If an opponent' piece is found,
+ it can be captured. After moving you can reorient the lancer.
+ li.
+ The sentry 'S' moves like a bishop but doesn't capture directly.
+ It "pushes" enemy pieces instead, either on an empty square or on other
+ enemy pieces which are thus (self-)captured.
+ li.
+ The jailer 'J' moves like a rook but also doesn't capture.
+ It immobilizes enemy pieces which are vertically or horizontally adjacent.
+
+p.
+ On the following diagram the white sentry can push the black lancer to
+ capture the black pawn on b4. The lancer is then immobilized
+ by the white jailer at a4.
+
+figure.diagram-container
+ .diagram.diag12
+ | fen:7k/8/8/8/Jp3m2/8/3S4/K7:
+ .diagram.diag22
+ | fen:7k/8/8/8/Jm3S2/8/8/K7:
+ figcaption Left: before white move S"push"f4. Right: after this move.
+
+h3 Complete rules
+
+p
+ | The rules were invented by Jeff Kubach (2020), who described them much
+ | more precisely on the
+ a(href="https://www.chessvariants.com/rules/8-piece-chess") chessvariants page
+ | . While the summary given above may suffice to start playing,
+ | you should read the complete rules to fully understand this variant.
p.boxed
- | TODO
+ | Aparecen tres nuevas piezas. Cada pieza es única.
+
+p.
+ Solo hay una torre, un alfil y un caballo por lado en esta variante.
+ Esto explica el nombre. El rey y la dama también están presentes.
+ Las tres ubicaciones restantes están ocupadas por nuevas piezas:
+
+ul
+ li.
+ La lanza 'L' está orientada y solo puede moverse en la dirección
+ como señala, tantas casillas como desee, siempre que lo haga
+ no encontrar pieza opuesta.
+ Si se encuentra dicha pieza, se puede capturar.
+ Después de mover puedes redirigir la lanza.
+ li.
+ La centinela 'S' (del término inglés "Sentry") se mueve como un alfil
+ pero no puede capturar directamente.
+ Por otro lado, puede "empujar" piezas opuestas sobre
+ una casilla vacía o en otra pieza enemiga, que luego termina
+ (auto-)capturado.
+ li.
+ El carcelero 'J' (del término inglés "Jailer") se mueve como una torre
+ pero tampoco captura. Inmoviliza cualquier pieza opuesta adyacente
+ vertical u horizontalmente.
+
+p.
+ En el siguiente diagrama, la centinela blanca puede empujar la lanza negra
+ para capturar el peón negro en b4. Entonces, la lanza es inmovilizada por el
+ carcelero blanco en a4.
+
+figure.diagram-container
+ .diagram.diag12
+ | fen:7k/8/8/8/Jp3m2/8/3S4/K7:
+ .diagram.diag22
+ | fen:7k/8/8/8/Jm3S2/8/8/K7:
+ figcaption.
+ Izquierda: antes del movimiento blanco S"empuja"f4.
+ Derecha: después de esta jugada.
+
+h3 Reglas completas
+
+p
+ | Las reglas fueron inventadas por Jeff Kubach (2020), quien las describió
+ | mucho más específicamente en la
+ a(href="https://www.chessvariants.com/rules/8-piece-chess") página chessvariants
+ | . El resumen anterior puede ser suficiente para comenzar a jugar,
+ | pero deberías leer todas las reglas para entender completamente
+ | esta variante.
p.boxed
- | TODO
+ | Trois nouvelles pièces apparaissent. Chaque pièces est unique.
+
+p.
+ Il n'y a qu'une tour, un fou et un cavalier par camp dans cette variante.
+ Ceci explique le nom. Le roi et la dame sont également présents,
+ les trois emplacements restants étant pris par de nouvelles pièces :
+
+ul
+ li.
+ Le lancier 'L' est orienté et ne peut se déplacer que dans la direction
+ qu'il pointe, d'autant de cases qu'il le souhaite tant qu'il ne
+ rencontre pas de pièce adverse.
+ Si une telle pièce est trouvée, elle peut être capturée.
+ Après le déplacement vous pouvez réorienter le lancier.
+ li.
+ La sentinelle 'S' se déplace comme un fou mais ne peut pas capturer
+ directement. Elle peut en revanche "pousser" les pièces adverses sur
+ une case vide ou sur une autre pièce ennemie, qui se retrouve alors
+ (auto-)capturée.
+ li.
+ Le geôlier 'J' (du terme anglais "Jailer") se déplace comme une tour mais
+ ne capture pas non plus. Il immobilise toute pièce adverse adjacente
+ verticalement ou horizontalement.
+
+p.
+ Sur le diagramme suivant la sentinelle blanche peut pousser le lancier noir
+ pour capturer le pion noir en b4. Le lancier est alors immobilisé par le
+ geôlier blanc en a4.
+
+figure.diagram-container
+ .diagram.diag12
+ | fen:7k/8/8/8/Jp3m2/8/3S4/K7:
+ .diagram.diag22
+ | fen:7k/8/8/8/Jm3S2/8/8/K7:
+ figcaption Gauche : avant le coup blanc S"pousse"f4. Droite : après ce coup.
+
+h3 Règles complètes
+
+p
+ | Les règles ont été inventées par Jeff Kubach (2020), qui les a décrites
+ | beaucoup plus précisément sur la
+ a(href="https://www.chessvariants.com/rules/8-piece-chess") page chessvariants
+ | . Le résumé donné ci-dessus peut suffire pour commencer à jouer,
+ | mais vous devriez lire l'intégralité des règles afin de bien comprendre
+ | cette variante.
boardDiv +=
"<img " +
"src='/images/pieces/" +
- vr.getPpath(board[i][j]) +
- ".svg' " +
+ vr.getPpath(board[i][j], null, null, orientation) +
+ V.IMAGE_EXTENSION + "' " +
"class='piece'/>";
}
if (markArray.length > 0 && markArray[i][j])
return "l";
}
+ static get IMAGE_EXTENSION() {
+ // Temporarily, for the time SVG pieces are being designed:
+ return ".png";
+ }
+
// Lancer directions *from white perspective*
static get LANCER_DIRS() {
return {
}
getPpath(b, color, score, orientation) {
- if ([V.JAILER, V.SENTRY].includes(b[1])) return "Eightpieces/" + b;
+ if ([V.JAILER, V.SENTRY].includes(b[1])) return "Eightpieces/tmp_png/" + b;
if (Object.keys(V.LANCER_DIRS).includes(b[1])) {
- if (orientation == 'w') return "Eightpieces/" + b;
+ if (orientation == 'w') return "Eightpieces/tmp_png/" + b;
// Find opposite direction for adequate display:
let oppDir = '';
switch (b[1]) {
oppDir = 'f';
break;
}
- return "Eightpieces/" + b[0] + oppDir;
+ return "Eightpieces/tmp_png/" + b[0] + oppDir;
}
- return b;
+ // TODO: after we have SVG pieces, remove the folder and next prefix:
+ return "Eightpieces/tmp_png/" + b;
}
getPPpath(b, orientation) {