From 90d128509cb2184cfc86bf13f9f6496704be237a Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Wed, 27 Dec 2023 12:52:14 +0100 Subject: [PATCH] Almost finished Cwda --- pieces/Cwda/CREDITS | 1 + pieces/Cwda/c_black_bishop.svg | 153 +++++++++++++++++ pieces/Cwda/c_black_king.svg | 89 ++++++++++ pieces/Cwda/c_black_knight.svg | 248 ++++++++++++++++++++++++++++ pieces/Cwda/c_black_pawn.svg | 61 +++++++ pieces/Cwda/c_black_queen.svg | 198 ++++++++++++++++++++++ pieces/Cwda/c_black_rook.svg | 108 ++++++++++++ pieces/Cwda/c_white_bishop.svg | 153 +++++++++++++++++ pieces/Cwda/c_white_king.svg | 85 ++++++++++ pieces/Cwda/c_white_knight.svg | 265 ++++++++++++++++++++++++++++++ pieces/Cwda/c_white_pawn.svg | 82 +++++++++ pieces/Cwda/c_white_queen.svg | 129 +++++++++++++++ pieces/Cwda/c_white_rook.svg | 106 ++++++++++++ pieces/Cwda/n_black_bishop.svg | 97 +++++++++++ pieces/Cwda/n_black_king.svg | 89 ++++++++++ pieces/Cwda/n_black_knight.svg | 117 +++++++++++++ pieces/Cwda/n_black_pawn.svg | 61 +++++++ pieces/Cwda/n_black_queen.svg | 182 ++++++++++++++++++++ pieces/Cwda/n_black_rook.svg | 98 +++++++++++ pieces/Cwda/n_white_bishop.svg | 81 +++++++++ pieces/Cwda/n_white_king.svg | 85 ++++++++++ pieces/Cwda/n_white_knight.svg | 114 +++++++++++++ pieces/Cwda/n_white_pawn.svg | 82 +++++++++ pieces/Cwda/n_white_queen.svg | 153 +++++++++++++++++ pieces/Cwda/n_white_rook.svg | 97 +++++++++++ pieces/Cwda/r_black_bishop.svg | 86 ++++++++++ pieces/Cwda/r_black_king.svg | 89 ++++++++++ pieces/Cwda/r_black_knight.svg | 136 +++++++++++++++ pieces/Cwda/r_black_pawn.svg | 61 +++++++ pieces/Cwda/r_black_queen.svg | 153 +++++++++++++++++ pieces/Cwda/r_black_rook.svg | 89 ++++++++++ pieces/Cwda/r_white_bishop.svg | 79 +++++++++ pieces/Cwda/r_white_king.svg | 85 ++++++++++ pieces/Cwda/r_white_knight.svg | 109 ++++++++++++ pieces/Cwda/r_white_pawn.svg | 83 ++++++++++ pieces/Cwda/r_white_queen.svg | 148 +++++++++++++++++ pieces/Cwda/r_white_rook.svg | 123 ++++++++++++++ variants.js | 2 +- variants/Cwda/class.js | 237 +++++++++++--------------- variants/Cwda/complete_rules.html | 128 +++++++++++++++ variants/Cwda/rules.html | 12 ++ variants/Cwda/style.css | 112 +++++++++++++ 42 files changed, 4524 insertions(+), 142 deletions(-) create mode 100644 pieces/Cwda/CREDITS create mode 100644 pieces/Cwda/c_black_bishop.svg create mode 100644 pieces/Cwda/c_black_king.svg create mode 100644 pieces/Cwda/c_black_knight.svg create mode 100644 pieces/Cwda/c_black_pawn.svg create mode 100644 pieces/Cwda/c_black_queen.svg create mode 100644 pieces/Cwda/c_black_rook.svg create mode 100644 pieces/Cwda/c_white_bishop.svg create mode 100644 pieces/Cwda/c_white_king.svg create mode 100644 pieces/Cwda/c_white_knight.svg create mode 100644 pieces/Cwda/c_white_pawn.svg create mode 100644 pieces/Cwda/c_white_queen.svg create mode 100644 pieces/Cwda/c_white_rook.svg create mode 100644 pieces/Cwda/n_black_bishop.svg create mode 100644 pieces/Cwda/n_black_king.svg create mode 100644 pieces/Cwda/n_black_knight.svg create mode 100644 pieces/Cwda/n_black_pawn.svg create mode 100644 pieces/Cwda/n_black_queen.svg create mode 100644 pieces/Cwda/n_black_rook.svg create mode 100644 pieces/Cwda/n_white_bishop.svg create mode 100644 pieces/Cwda/n_white_king.svg create mode 100644 pieces/Cwda/n_white_knight.svg create mode 100644 pieces/Cwda/n_white_pawn.svg create mode 100644 pieces/Cwda/n_white_queen.svg create mode 100644 pieces/Cwda/n_white_rook.svg create mode 100644 pieces/Cwda/r_black_bishop.svg create mode 100644 pieces/Cwda/r_black_king.svg create mode 100644 pieces/Cwda/r_black_knight.svg create mode 100644 pieces/Cwda/r_black_pawn.svg create mode 100644 pieces/Cwda/r_black_queen.svg create mode 100644 pieces/Cwda/r_black_rook.svg create mode 100644 pieces/Cwda/r_white_bishop.svg create mode 100644 pieces/Cwda/r_white_king.svg create mode 100644 pieces/Cwda/r_white_knight.svg create mode 100644 pieces/Cwda/r_white_pawn.svg create mode 100644 pieces/Cwda/r_white_queen.svg create mode 100644 pieces/Cwda/r_white_rook.svg create mode 100644 variants/Cwda/complete_rules.html create mode 100644 variants/Cwda/rules.html create mode 100644 variants/Cwda/style.css diff --git a/pieces/Cwda/CREDITS b/pieces/Cwda/CREDITS new file mode 100644 index 0000000..2d04719 --- /dev/null +++ b/pieces/Cwda/CREDITS @@ -0,0 +1 @@ +Pieces designed by "Couch Tomato #2218" on Discord, diff --git a/pieces/Cwda/c_black_bishop.svg b/pieces/Cwda/c_black_bishop.svg new file mode 100644 index 0000000..f9f069b --- /dev/null +++ b/pieces/Cwda/c_black_bishop.svg @@ -0,0 +1,153 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_black_king.svg b/pieces/Cwda/c_black_king.svg new file mode 100644 index 0000000..953aee8 --- /dev/null +++ b/pieces/Cwda/c_black_king.svg @@ -0,0 +1,89 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_black_knight.svg b/pieces/Cwda/c_black_knight.svg new file mode 100644 index 0000000..ed8ead5 --- /dev/null +++ b/pieces/Cwda/c_black_knight.svg @@ -0,0 +1,248 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_black_pawn.svg b/pieces/Cwda/c_black_pawn.svg new file mode 100644 index 0000000..6b0df69 --- /dev/null +++ b/pieces/Cwda/c_black_pawn.svg @@ -0,0 +1,61 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/pieces/Cwda/c_black_queen.svg b/pieces/Cwda/c_black_queen.svg new file mode 100644 index 0000000..a7e6633 --- /dev/null +++ b/pieces/Cwda/c_black_queen.svg @@ -0,0 +1,198 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_black_rook.svg b/pieces/Cwda/c_black_rook.svg new file mode 100644 index 0000000..cfb7532 --- /dev/null +++ b/pieces/Cwda/c_black_rook.svg @@ -0,0 +1,108 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_white_bishop.svg b/pieces/Cwda/c_white_bishop.svg new file mode 100644 index 0000000..2b93f11 --- /dev/null +++ b/pieces/Cwda/c_white_bishop.svg @@ -0,0 +1,153 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_white_king.svg b/pieces/Cwda/c_white_king.svg new file mode 100644 index 0000000..a13d1a8 --- /dev/null +++ b/pieces/Cwda/c_white_king.svg @@ -0,0 +1,85 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_white_knight.svg b/pieces/Cwda/c_white_knight.svg new file mode 100644 index 0000000..fa874ef --- /dev/null +++ b/pieces/Cwda/c_white_knight.svg @@ -0,0 +1,265 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_white_pawn.svg b/pieces/Cwda/c_white_pawn.svg new file mode 100644 index 0000000..d6df722 --- /dev/null +++ b/pieces/Cwda/c_white_pawn.svg @@ -0,0 +1,82 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_white_queen.svg b/pieces/Cwda/c_white_queen.svg new file mode 100644 index 0000000..cc58283 --- /dev/null +++ b/pieces/Cwda/c_white_queen.svg @@ -0,0 +1,129 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/c_white_rook.svg b/pieces/Cwda/c_white_rook.svg new file mode 100644 index 0000000..f51d40d --- /dev/null +++ b/pieces/Cwda/c_white_rook.svg @@ -0,0 +1,106 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_black_bishop.svg b/pieces/Cwda/n_black_bishop.svg new file mode 100644 index 0000000..dab8405 --- /dev/null +++ b/pieces/Cwda/n_black_bishop.svg @@ -0,0 +1,97 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_black_king.svg b/pieces/Cwda/n_black_king.svg new file mode 100644 index 0000000..10ecec8 --- /dev/null +++ b/pieces/Cwda/n_black_king.svg @@ -0,0 +1,89 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_black_knight.svg b/pieces/Cwda/n_black_knight.svg new file mode 100644 index 0000000..f6bd03f --- /dev/null +++ b/pieces/Cwda/n_black_knight.svg @@ -0,0 +1,117 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_black_pawn.svg b/pieces/Cwda/n_black_pawn.svg new file mode 100644 index 0000000..73488c5 --- /dev/null +++ b/pieces/Cwda/n_black_pawn.svg @@ -0,0 +1,61 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/pieces/Cwda/n_black_queen.svg b/pieces/Cwda/n_black_queen.svg new file mode 100644 index 0000000..7abeae9 --- /dev/null +++ b/pieces/Cwda/n_black_queen.svg @@ -0,0 +1,182 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_black_rook.svg b/pieces/Cwda/n_black_rook.svg new file mode 100644 index 0000000..a56cc84 --- /dev/null +++ b/pieces/Cwda/n_black_rook.svg @@ -0,0 +1,98 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_white_bishop.svg b/pieces/Cwda/n_white_bishop.svg new file mode 100644 index 0000000..85f032e --- /dev/null +++ b/pieces/Cwda/n_white_bishop.svg @@ -0,0 +1,81 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_white_king.svg b/pieces/Cwda/n_white_king.svg new file mode 100644 index 0000000..49c3271 --- /dev/null +++ b/pieces/Cwda/n_white_king.svg @@ -0,0 +1,85 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_white_knight.svg b/pieces/Cwda/n_white_knight.svg new file mode 100644 index 0000000..1066139 --- /dev/null +++ b/pieces/Cwda/n_white_knight.svg @@ -0,0 +1,114 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_white_pawn.svg b/pieces/Cwda/n_white_pawn.svg new file mode 100644 index 0000000..6bdfc16 --- /dev/null +++ b/pieces/Cwda/n_white_pawn.svg @@ -0,0 +1,82 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_white_queen.svg b/pieces/Cwda/n_white_queen.svg new file mode 100644 index 0000000..9357f93 --- /dev/null +++ b/pieces/Cwda/n_white_queen.svg @@ -0,0 +1,153 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/n_white_rook.svg b/pieces/Cwda/n_white_rook.svg new file mode 100644 index 0000000..bfaae26 --- /dev/null +++ b/pieces/Cwda/n_white_rook.svg @@ -0,0 +1,97 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_black_bishop.svg b/pieces/Cwda/r_black_bishop.svg new file mode 100644 index 0000000..2c8fc2d --- /dev/null +++ b/pieces/Cwda/r_black_bishop.svg @@ -0,0 +1,86 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_black_king.svg b/pieces/Cwda/r_black_king.svg new file mode 100644 index 0000000..672f3c2 --- /dev/null +++ b/pieces/Cwda/r_black_king.svg @@ -0,0 +1,89 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_black_knight.svg b/pieces/Cwda/r_black_knight.svg new file mode 100644 index 0000000..131b5d0 --- /dev/null +++ b/pieces/Cwda/r_black_knight.svg @@ -0,0 +1,136 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_black_pawn.svg b/pieces/Cwda/r_black_pawn.svg new file mode 100644 index 0000000..16a15b4 --- /dev/null +++ b/pieces/Cwda/r_black_pawn.svg @@ -0,0 +1,61 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/pieces/Cwda/r_black_queen.svg b/pieces/Cwda/r_black_queen.svg new file mode 100644 index 0000000..78c3f98 --- /dev/null +++ b/pieces/Cwda/r_black_queen.svg @@ -0,0 +1,153 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_black_rook.svg b/pieces/Cwda/r_black_rook.svg new file mode 100644 index 0000000..0db1444 --- /dev/null +++ b/pieces/Cwda/r_black_rook.svg @@ -0,0 +1,89 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_white_bishop.svg b/pieces/Cwda/r_white_bishop.svg new file mode 100644 index 0000000..05cfc70 --- /dev/null +++ b/pieces/Cwda/r_white_bishop.svg @@ -0,0 +1,79 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_white_king.svg b/pieces/Cwda/r_white_king.svg new file mode 100644 index 0000000..317f686 --- /dev/null +++ b/pieces/Cwda/r_white_king.svg @@ -0,0 +1,85 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_white_knight.svg b/pieces/Cwda/r_white_knight.svg new file mode 100644 index 0000000..52f10e5 --- /dev/null +++ b/pieces/Cwda/r_white_knight.svg @@ -0,0 +1,109 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_white_pawn.svg b/pieces/Cwda/r_white_pawn.svg new file mode 100644 index 0000000..43ce32f --- /dev/null +++ b/pieces/Cwda/r_white_pawn.svg @@ -0,0 +1,83 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_white_queen.svg b/pieces/Cwda/r_white_queen.svg new file mode 100644 index 0000000..22d6d4f --- /dev/null +++ b/pieces/Cwda/r_white_queen.svg @@ -0,0 +1,148 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pieces/Cwda/r_white_rook.svg b/pieces/Cwda/r_white_rook.svg new file mode 100644 index 0000000..d26e5c7 --- /dev/null +++ b/pieces/Cwda/r_white_rook.svg @@ -0,0 +1,123 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/variants.js b/variants.js index 9ff40a7..524538c 100644 --- a/variants.js +++ b/variants.js @@ -39,7 +39,7 @@ const variants = [ {name: 'Crazyhouse', desc: 'Captures reborn'}, {name: 'Crossing', desc: 'Cross the river'}, {name: 'Cylinder', desc: 'Neverending rows'}, -// {name: 'Cwda', desc: 'New teams', disp: 'Different armies'}, + {name: 'Cwda', desc: 'New teams', disp: 'Different armies'}, {name: 'Dark', desc: 'In the shadow'}, // {name: 'Diamond', desc: 'Rotating board'}, // {name: 'Dice', desc: 'Roll the dice'}, diff --git a/variants/Cwda/class.js b/variants/Cwda/class.js index 393e407..3a47146 100644 --- a/variants/Cwda/class.js +++ b/variants/Cwda/class.js @@ -1,4 +1,5 @@ import ChessRules from "/base_rules.js"; +import {FenUtil} from "/utils/setupPieces.js" export default class CwdaRules extends ChessRules { @@ -76,21 +77,21 @@ export default class CwdaRules extends ChessRules { } ); let pawnLines = { - w: "pppppppp", - b: "pppppppp" + w: Array(8).fill('p'), + b: Array(8).fill('p') }; for (const c of ['w', 'b']) { const army = "army" + (c == 'w' ? "1" : "2"); if (this.options[army] != 'F') { - for (let obj of [s, pawnLines]) { - obj[c] = obj[c].split("") - .map(p => V.PiecesMap[this.options[army]][p]).join(""); - } + for (let obj of [s, pawnLines]) + obj[c] = obj[c].map(p => V.PiecesMap[this.options[army]][p]); } } return { fen: s.b.join("") + "/" + - pawnLines['b'] + "/8/8/8/8/" + pawnLines['w'].toUpperCase() + + pawnLines['b'].join("") + + "/8/8/8/8/" + + pawnLines['w'].join("").toUpperCase() + "/" + s.w.join("").toUpperCase(), o: {flags: s.flags} }; @@ -105,8 +106,8 @@ export default class CwdaRules extends ChessRules { setOtherVariables(fenParsed) { super.setOtherVariables(fenParsed); - this.army1 = fenParsed.armies.charAt(0); - this.army2 = fenParsed.armies.charAt(1); + this.options["army1"] = fenParsed.armies.charAt(0); + this.options["army2"] = fenParsed.armies.charAt(1); } isKing(x, y, p) { @@ -165,12 +166,14 @@ export default class CwdaRules extends ChessRules { pieces(color, x, y) { const res = super.pieces(color, x, y); + const backward = (color == 'w' ? 1 : -1); + const forward = -backward; return Object.assign( { 'd': { "class": "c_rook", both: [ - {steps: V.steps.b}, + {steps: res['b'].both[0].steps}, {steps: V.steps.d, range: 1} ] }, @@ -178,7 +181,7 @@ export default class CwdaRules extends ChessRules { "class": "c_knight", both: [ {steps: V.steps.a, range: 1}, - {steps: V.steps.r, range: 1} + {steps: res['r'].both[0].steps, range: 1} ] }, 'f': { @@ -186,170 +189,122 @@ export default class CwdaRules extends ChessRules { both: [ {steps: V.steps.d, range: 1}, {steps: V.steps.a, range: 1}, - {steps: V.steps.b, range: 1} + {steps: res['b'].both[0].steps, range: 1} ] }, 'c': { "class": "c_queen", both: [ - {steps: V.steps.b}, - {steps: V.steps.n, range: 1} + {steps: res['b'].both[0].steps}, + {steps: res['n'].both[0].steps, range: 1} ] }, - 'm': { moveas: 'k' }, - 'z': { moveas: 'p' }, + 'm': { "class": "c_king", moveas: 'k' }, + 'z': { "class": "c_pawn", moveas: 'p' }, 'g': { - + "class": "n_rook", + both: [ + {steps: [[0, -1], [0, 1], [color == 'w' ? -1 : 1, 0]]}, + {steps: [[backward, -1], [backward, 0], [backward, 1]], range: 1} + ] }, 'i': { - + "class": "n_knight", + both: [ + {steps: V.steps.$n, range: 1}, + {steps: V.steps.f, range: 1} + ] }, 't': { - + "class": "n_bishop", + both: [ + { + steps: [[0, -1], [0, 1], [backward, -1], + [backward, 0], [backward, 1]], + range: 1 + }, + { + steps: [[2*forward, -1], [2*forward, 1], + [forward, -2], [forward, 2]], + range: 1 + } + ] }, 'l': { - + "class": "n_queen", + both: [ + {steps: [[0, -1], [0, 1], [forward, 0]]}, + {steps: [[forward, -1], [forward, 1], + [backward, -1], [backward, 0], [backward, 1]], range: 1}, + {steps: [[2*forward, -1], [2*forward, 1], + [forward, -2], [forward, 2]], range: 1} + ] }, - 'e': { moveas: 'k' }, - 'v': { moveas: 'p' }, + 'e': { "class": "n_king", moveas: 'k' }, + 'v': { "class": "n_pawn", moveas: 'p' }, 's': { - + "class": "r_rook", + both: [{steps: res['r'].both[0].steps, range: 4}] }, 'y': { - + "class": "r_knight", + both: [ + {steps: V.steps.d, range: 1}, + {steps: V.steps.w, range: 1} + ] }, 'h': { - + "class": "r_bishop", + both: [ + {steps: V.steps.d, range: 1}, + {steps: V.steps.f, range: 1}, + {steps: V.steps.$3, range: 1} + ] }, 'o': { - + "class": "r_queen", + both: [ + {steps: res['r'].both[0].steps}, + {steps: res['n'].both[0].steps, range: 1} + ] }, - 'a': { moveas: 'k' }, - 'u': { moveas: 'p' } + 'a': { "class": "r_king", moveas: 'k' }, + 'u': { "class": "r_pawn", moveas: 'p' } }, res ); - - - - - - getPotentialN_rookMoves(sq) { - const c = this.turn; - const rookSteps = [ [0, -1], [0, 1], [c == 'w' ? -1 : 1, 0] ]; - const backward = (c == 'w' ? 1 : -1); - const kingSteps = [ [backward, -1], [backward, 0], [backward, 1] ]; - return ( - this.getSlideNJumpMoves(sq, rookSteps).concat( - this.getSlideNJumpMoves(sq, kingSteps, 1)) - ); - } - - getPotentialN_knightMoves(sq) { - return ( - this.getSlideNJumpMoves(sq, V.steps.$n, 1).concat( - this.getSlideNJumpMoves(sq, V.steps.f, 1)) - ); - } - - getPotentialN_bishopMoves(sq) { - const backward = (this.turn == 'w' ? 1 : -1); - const kingSteps = [ - [0, -1], [0, 1], [backward, -1], [backward, 0], [backward, 1] - ]; - const forward = -backward; - const knightSteps = [ - [2*forward, -1], [2*forward, 1], [forward, -2], [forward, 2] - ]; - return ( - this.getSlideNJumpMoves(sq, knightSteps, 1).concat( - this.getSlideNJumpMoves(sq, kingSteps, 1)) - ); - } - - getPotentialN_queenMoves(sq) { - const backward = (this.turn == 'w' ? 1 : -1); - const forward = -backward; - const kingSteps = [ - [forward, -1], [forward, 1], - [backward, -1], [backward, 0], [backward, 1] - ]; - const knightSteps = [ - [2*forward, -1], [2*forward, 1], [forward, -2], [forward, 2] - ]; - const rookSteps = [ [0, -1], [0, 1], [forward, 0] ]; - return ( - this.getSlideNJumpMoves(sq, rookSteps).concat( - this.getSlideNJumpMoves(sq, kingSteps, 1)).concat( - this.getSlideNJumpMoves(sq, knightSteps, 1)) - ); - } - - getPotentialR_rookMoves(sq) { - return this.getSlideNJumpMoves(sq, V.steps.r, 4); } - getPotentialR_knightMoves(sq) { - return ( - this.getSlideNJumpMoves(sq, V.steps.d, 1).concat( - this.getSlideNJumpMoves(sq, V.steps.w, 1)) - ); - } - - getPotentialR_bishopMoves(sq) { - return ( - this.getSlideNJumpMoves(sq, V.steps.d, 1).concat( - this.getSlideNJumpMoves(sq, V.steps.f, 1)).concat( - this.getSlideNJumpMoves(sq, V.steps.$3, 1)) - ); - } - - getPotentialR_queenMoves(sq) { - return ( - this.getSlideNJumpMoves(sq, V.steps.r).concat( - this.getSlideNJumpMoves(sq, V.steps.n, 1)) - ); - } - - case V.PAWN: { - // Can promote in anything from the two current armies - let promotions = []; - for (let army of ["army1", "army2"]) { - if (army == "army2" && this.army2 == this.army1) break; - switch (this[army]) { - case 'C': { - Array.prototype.push.apply(promotions, - [V.C_ROOK, V.C_KNIGHT, V.C_BISHOP, V.C_QUEEN]); - break; - } - case 'N': { - Array.prototype.push.apply(promotions, - [V.N_ROOK, V.N_KNIGHT, V.N_BISHOP, V.N_QUEEN]); - break; - } - case 'R': { - Array.prototype.push.apply(promotions, - [V.R_ROOK, V.R_KNIGHT, V.R_BISHOP, V.R_QUEEN]); - break; - } - case 'F': { - Array.prototype.push.apply(promotions, - [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN]); - break; - } - } - } - return super.getPotentialPawnMoves(sq, promotions); + get pawnPromotions() { + // Can promote in anything from the two current armies + let promotions = []; + for (let army of ["army1", "army2"]) { + if (army == "army2" && this.options["army2"] == this.options["army1"]) + break; + switch (this.options[army]) { + case 'C': + Array.prototype.push.apply(promotions, ['d', 'w', 'f', 'c']); + break; + case 'N': + Array.prototype.push.apply(promotions, ['g', 'i', 't', 'l']); + break; + case 'R': + Array.prototype.push.apply(promotions, ['s', 'y', 'h', 'o']); + break; + case 'F': + Array.prototype.push.apply(promotions, ['r', 'n', 'b', 'q']); + break; } - default: return super.getPotentialMovesFrom(sq); } + return promotions; + } getCastleMoves([x, y]) { const color = this.getColor(x, y); - let finalSquares = [ [2, 3], [V.size.y - 2, V.size.y - 3] ]; + let finalSquares = [ [2, 3], [this.size.y - 2, this.size.y - 3] ]; if ( - (color == 'w' && this.army1 == 'C') || - (color == 'b' && this.army2 == 'C') + (color == 'w' && this.options["army1"] == 'C') || + (color == 'b' && this.options["army2"] == 'C') ) { // Colorbound castle long in an unusual way: finalSquares[0] = [1, 2]; diff --git a/variants/Cwda/complete_rules.html b/variants/Cwda/complete_rules.html new file mode 100644 index 0000000..958c0b6 --- /dev/null +++ b/variants/Cwda/complete_rules.html @@ -0,0 +1,128 @@ + + + Different Armies Rules + + + + + +
+

Different Armies Rules

+ +
+

White and black pieces are replaced by different armies.

+

+ Pawns and kings move as usual, but the other pieces generally do not. + Indeed, before the game start you must select two armies, defining + new movements for "rooks", "knights", "bishops" and "queens". +

+

Pieces movements are described using these simple pieces:

+
    +
  • Dabbabah = jump two squares orthogonally
  • +
  • Alfil = jump two squares diagonally
  • +
  • Wazir = one square orthogonally
  • +
  • Ferz = one square diagonally
  • +
  • Three leaper (L3) = jump three squares orthogonally
  • +
  • Narrow knight = knight without "2+1 lateral moves"
  • +
+

Pawns can be promoted into a piece of any of the two armies playing.

+
+ +

The Colorbound Clobberers

+ +
+ + + +
+
+
+
+
+
+ Moves of the Bede on the left, and of the Waffle on the right. +
+
+ +
+
fen:8/8/8/3F4/8/8/8/8 b7,c6,b5,f5,d3,d7,b3,c4,e4,f3,e6,f7:
+
+ Moves of the Fad. +
+
+ +

+ When castling large, the king and rook arrive respectively on + b1/b8 and c1/c8 so that the rook remains on the same color. +

+ +

The Nutty Knights

+ +
+ + + +
+
fen:8/8/8/8/3G4/8/8/8 d5,d6,d7,d8,c4,b4,a4,e4,f4,g4,h4,c3,d3,e3:
+
fen:8/8/8/8/4i3/8/8/8 d6,d2,f6,f2,d3,d5,f5,f3:
+
+ Moves of the Charging rook on the left, and of the Fibnif on the right. +
+
+ +
+
fen:8/8/8/8/3T4/8/8/8 b5,c6,e6,f5,c4,e4,c3,d3,e3:
+
fen:8/8/8/8/4c3/8/8/8 e5,e6,e7,e8,d4,c4,b4,a4,f4,g4,h4,d6,c5,f6,g5,d5,f5,d3,e3,f3:
+
+ Moves of the Charging knight on the left, and of the Colonel on the right. +
+
+ +

The Remarkable Rookies

+ +
+ + + +
+
fen:8/8/8/3y4/8/8/8/8 d3,b5,d7,f5,c5,d6,e5,d4:
+
fen:8/8/8/4H3/8/8/8/8 c5,e7,g5,e3,b5,e8,h5,e2,d4,d6,f6,f4:
+
+ Moves of the Woody rook on the left, and of the Half-duck on the right. +
+
+ +

Fide army

+ +

The standard chess pieces.

+ +

Source

+ +

Chess with different armies on chessvariants.com.

+ + + + + diff --git a/variants/Cwda/rules.html b/variants/Cwda/rules.html new file mode 100644 index 0000000..cbd2d72 --- /dev/null +++ b/variants/Cwda/rules.html @@ -0,0 +1,12 @@ +

+ Chess with different armies. Default: + + Colorbound Clobberers + . +

+ + + Full rules description. + + +

Ralph Betza (1996).

diff --git a/variants/Cwda/style.css b/variants/Cwda/style.css new file mode 100644 index 0000000..f9f7679 --- /dev/null +++ b/variants/Cwda/style.css @@ -0,0 +1,112 @@ +@import url("/base_pieces.css"); + +piece.white.c_rook { + background-image: url('/pieces/Cwda/c_white_rook.svg'); +} +piece.black.c_rook { + background-image: url('/pieces/Cwda/c_black_rook.svg'); +} +piece.white.c_knight { + background-image: url('/pieces/Cwda/c_white_knight.svg'); +} +piece.black.c_knight { + background-image: url('/pieces/Cwda/c_black_knight.svg'); +} +piece.white.c_bishop { + background-image: url('/pieces/Cwda/c_white_bishop.svg'); +} +piece.black.c_bishop { + background-image: url('/pieces/Cwda/c_black_bishop.svg'); +} +piece.white.c_queen { + background-image: url('/pieces/Cwda/c_white_queen.svg'); +} +piece.black.c_queen { + background-image: url('/pieces/Cwda/c_black_queen.svg'); +} +piece.white.c_king { + background-image: url('/pieces/Cwda/c_white_king.svg'); +} +piece.black.c_king { + background-image: url('/pieces/Cwda/c_black_king.svg'); +} +piece.white.c_pawn { + background-image: url('/pieces/Cwda/c_white_pawn.svg'); +} +piece.black.c_pawn { + background-image: url('/pieces/Cwda/c_black_pawn.svg'); +} + +piece.white.n_rook { + background-image: url('/pieces/Cwda/n_white_rook.svg'); +} +piece.black.n_rook { + background-image: url('/pieces/Cwda/n_black_rook.svg'); +} +piece.white.n_knight { + background-image: url('/pieces/Cwda/n_white_knight.svg'); +} +piece.black.n_knight { + background-image: url('/pieces/Cwda/n_black_knight.svg'); +} +piece.white.n_bishop { + background-image: url('/pieces/Cwda/n_white_bishop.svg'); +} +piece.black.n_bishop { + background-image: url('/pieces/Cwda/n_black_bishop.svg'); +} +piece.white.n_queen { + background-image: url('/pieces/Cwda/n_white_queen.svg'); +} +piece.black.n_queen { + background-image: url('/pieces/Cwda/n_black_queen.svg'); +} +piece.white.n_king { + background-image: url('/pieces/Cwda/n_white_king.svg'); +} +piece.black.n_king { + background-image: url('/pieces/Cwda/n_black_king.svg'); +} +piece.white.n_pawn { + background-image: url('/pieces/Cwda/n_white_pawn.svg'); +} +piece.black.n_pawn { + background-image: url('/pieces/Cwda/n_black_pawn.svg'); +} + +piece.white.r_rook { + background-image: url('/pieces/Cwda/r_white_rook.svg'); +} +piece.black.r_rook { + background-image: url('/pieces/Cwda/r_black_rook.svg'); +} +piece.white.r_knight { + background-image: url('/pieces/Cwda/r_white_knight.svg'); +} +piece.black.r_knight { + background-image: url('/pieces/Cwda/r_black_knight.svg'); +} +piece.white.r_bishop { + background-image: url('/pieces/Cwda/r_white_bishop.svg'); +} +piece.black.r_bishop { + background-image: url('/pieces/Cwda/r_black_bishop.svg'); +} +piece.white.r_queen { + background-image: url('/pieces/Cwda/r_white_queen.svg'); +} +piece.black.r_queen { + background-image: url('/pieces/Cwda/r_black_queen.svg'); +} +piece.white.r_king { + background-image: url('/pieces/Cwda/r_white_king.svg'); +} +piece.black.r_king { + background-image: url('/pieces/Cwda/r_black_king.svg'); +} +piece.white.r_pawn { + background-image: url('/pieces/Cwda/r_white_pawn.svg'); +} +piece.black.r_pawn { + background-image: url('/pieces/Cwda/r_black_pawn.svg'); +} -- 2.44.0