From: Benjamin Auder Date: Fri, 16 Sep 2022 10:10:04 +0000 (+0200) Subject: Draft Capablanca chess + add TODO related to move transmission issues X-Git-Url: https://git.auder.net/images/doc/html/current/pieces/scripts/%7B%7B%20targetUrl%20%7D%7D?a=commitdiff_plain;h=c9a20f4f198e1877bd260a610b1692b3d65d0eba;p=xogo.git Draft Capablanca chess + add TODO related to move transmission issues --- diff --git a/README.md b/README.md index d478093..15f6772 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# xogo.live +# xogo.casa Simplified version of old vchess.club, to focus on the essential : the game. diff --git a/base_rules.js b/base_rules.js index 162fad0..d609a56 100644 --- a/base_rules.js +++ b/base_rules.js @@ -2640,6 +2640,7 @@ export default class ChessRules { let container = document.getElementById(this.containerId); if (document.hidden) { document.onvisibilitychange = () => { + // TODO here: page reload ?! (some issues if tab changed...) document.onvisibilitychange = undefined; checkDisplayThenAnimate(700); }; diff --git a/variants/Absorption/class.js b/variants/Absorption/class.js index 5f58c32..ea91a27 100644 --- a/variants/Absorption/class.js +++ b/variants/Absorption/class.js @@ -23,7 +23,6 @@ export default class AbsorptionRules extends ChessRules { pieces(color, x, y) { let fusions = { - // amazon 'a': { "class": "amazon", both: [ @@ -42,7 +41,6 @@ export default class AbsorptionRules extends ChessRules { } ] }, - // empress 'e': { "class": "empress", both: [ @@ -60,7 +58,6 @@ export default class AbsorptionRules extends ChessRules { } ] }, - // princess 's': { "class": "princess", both: [ diff --git a/variants/Capablanca/class.js b/variants/Capablanca/class.js new file mode 100644 index 0000000..342429b --- /dev/null +++ b/variants/Capablanca/class.js @@ -0,0 +1,69 @@ +import ChessRules from "/base_rules.js"; + +export default class CapablancaRules extends ChessRules { + + get pawnPromotions() { + return ['q', 'e', 's', 'r', 'n', 'b']; + } + + pieces(color, x, y) { + let newPieces = { + 'e': { + "class": "empress", + both: [ + { + steps: [ + [1, 0], [-1, 0], [0, 1], [0, -1] + ] + }, + { + steps: [ + [1, 2], [1, -2], [-1, 2], [-1, -2], + [2, 1], [-2, 1], [2, -1], [-2, -1] + ], + range: 1 + } + ] + }, + 's': { + "class": "princess", + both: [ + { + steps: [ + [1, 1], [1, -1], [-1, 1], [-1, -1] + ] + }, + { + steps: [ + [1, 2], [1, -2], [-1, 2], [-1, -2], + [2, 1], [-2, 1], [2, -1], [-2, -1] + ], + range: 1 + } + ] + } + }; + return Object.assign(newPieces, super.pieces(color, x, y)); + } + + get size() { + return {x: 8, y: 10}; + } + + genRandInitBaseFen() { + const s = FenUtil.setupPieces( + ['r', 'n', 's', 'b', 'q', 'k', 'b', 'e', 'n', 'r'], + { + between: {p1: 'k', p2: 'r'}, + diffCol: ['b'], + flags: ['r'] + } + ); + return { + fen: s.b.join("") + "/pppppppppp/91/91/91/91/PPPPPPPPPP/" + + s.w.join("").toUpperCase(), + o: {flags: s.flags} + }; + } + +}; diff --git a/variants/Capablanca/rules.html b/variants/Capablanca/rules.html new file mode 100644 index 0000000..0f29d53 --- /dev/null +++ b/variants/Capablanca/rules.html @@ -0,0 +1,6 @@ +

+ Chess on a larger board, with two extra pieces combining the + abilities of rook and knight (empress), or bishop and knight (princess) +

+ +

Jose Raul Capablanca (1925).

diff --git a/variants/Capablanca/style.css b/variants/Capablanca/style.css new file mode 100644 index 0000000..10d9eac --- /dev/null +++ b/variants/Capablanca/style.css @@ -0,0 +1,17 @@ +@import url("/base_pieces.css"); + +piece.black.empress { + background-image: url('/pieces/black_empress.svg'); +} + +piece.black.princess { + background-image: url('/pieces/black_princess.svg'); +} + +piece.white.empress { + background-image: url('/pieces/white_empress.svg'); +} + +piece.white.princess { + background-image: url('/pieces/white_princess.svg'); +}