Drop Half chess: does not seem very interesting after all
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 12 Dec 2018 10:40:57 +0000 (11:40 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 12 Dec 2018 10:40:57 +0000 (11:40 +0100)
public/javascripts/variants/Half.js [deleted file]
variants.js
views/rules/Half.pug [deleted file]

diff --git a/public/javascripts/variants/Half.js b/public/javascripts/variants/Half.js
deleted file mode 100644 (file)
index 6c6c7eb..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-// Standard rules on a 4x8 board with no pawns
-class HalfRules extends ChessRules
-{
-       initVariables(fen)
-       {
-               this.kingPos = {'w':[-1,-1], 'b':[-1,-1]};
-               const fenParts = fen.split(" ");
-               const position = fenParts[0].split("/");
-               for (let i=0; i<position.length; i++)
-               {
-                       let k = 0;
-                       for (let j=0; j<position[i].length; j++)
-                       {
-                               switch (position[i].charAt(j))
-                               {
-                                       case 'k':
-                                               this.kingPos['b'] = [i,k];
-                                               break;
-                                       case 'K':
-                                               this.kingPos['w'] = [i,k];
-                                               break;
-                                       default:
-                                               let num = parseInt(position[i].charAt(j));
-                                               if (!isNaN(num))
-                                                       k += (num-1);
-                               }
-                               k++;
-                       }
-               }
-               // No pawns so no ep., but otherwise we must redefine play()
-               this.epSquares = [];
-       }
-
-       setFlags(fen)
-       {
-               // No castling, hence no flags; but flags defined for compatibility
-               this.castleFlags = { "w":[false,false], "b":[false,false] };
-       }
-
-       static get size() { return [4,8]; }
-
-       getPotentialKingMoves(sq)
-       {
-               const V = VariantRules;
-               // No castling
-               return this.getSlideNJumpMoves(sq,
-                       V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep");
-       }
-
-       isAttacked(sq, colors)
-       {
-               return (this.isAttackedByRook(sq, colors)
-                       || this.isAttackedByKnight(sq, colors)
-                       || this.isAttackedByBishop(sq, colors)
-                       || this.isAttackedByQueen(sq, colors)
-                       || this.isAttackedByKing(sq, colors));
-       }
-
-       updateVariables(move)
-       {
-               // Just update king position
-               const piece = this.getPiece(move.start.x,move.start.y);
-               const c = this.getColor(move.start.x,move.start.y);
-               if (piece == VariantRules.KING)
-               {
-                       this.kingPos[c][0] = move.appear[0].x;
-                       this.kingPos[c][1] = move.appear[0].y;
-               }
-       }
-
-       static GenRandInitFen()
-       {
-               let minorPieces = { "w": new Array(4), "b": new Array(4) };
-               let majorPieces = { "w": new Array(4), "b": new Array(4) };
-               for (let c of ["w","b"])
-               {
-                       // Minor pieces first (on 2nd rank)
-                       let positions = _.range(4);
-
-                       // Get random squares for bishops
-                       let randIndex = 2 * _.random(1);
-                       let bishop1Pos = positions[randIndex];
-                       let randIndex_tmp = 2 * _.random(1) + 1;
-                       let bishop2Pos = positions[randIndex_tmp];
-                       positions.splice(Math.max(randIndex,randIndex_tmp), 1);
-                       positions.splice(Math.min(randIndex,randIndex_tmp), 1);
-
-                       // Get random squares for knights
-                       randIndex = _.random(1);
-                       let knight1Pos = positions[randIndex];
-                       positions.splice(randIndex, 1);
-                       let knight2Pos = positions[0];
-
-                       minorPieces[c][bishop1Pos] = 'b';
-                       minorPieces[c][bishop2Pos] = 'b';
-                       minorPieces[c][knight1Pos] = 'n';
-                       minorPieces[c][knight2Pos] = 'n';
-
-                       // Major pieces then (on 1st rank)
-                       positions = _.range(4);
-
-                       // Get random square for queen
-                       randIndex = _.random(3);
-                       let queenPos = positions[randIndex];
-                       positions.splice(randIndex, 1);
-
-                       // Random square for king (no castle)
-                       randIndex = _.random(2);
-                       let kingPos = positions[randIndex];
-                       positions.splice(randIndex, 1);
-
-                       // Rooks and king positions:
-                       let rook1Pos = positions[0];
-                       let rook2Pos = positions[1];
-
-                       majorPieces[c][rook1Pos] = 'r';
-                       majorPieces[c][rook2Pos] = 'r';
-                       majorPieces[c][kingPos] = 'k';
-                       majorPieces[c][queenPos] = 'q';
-               }
-               let fen = "";
-               for (let i=0; i<4; i++)
-               {
-                       fen += majorPieces["b"][i] + minorPieces["b"][i] + "4" +
-                               minorPieces["w"][i].toUpperCase() + majorPieces["w"][i].toUpperCase();
-                       if (i < 3)
-                               fen += "/";
-               }
-               fen += " 0000"; //TODO: flags?!
-               return fen;
-       }
-}
index 5623334..2a20ffd 100644 (file)
@@ -13,5 +13,4 @@ module.exports = [
        { "name": "Switching", "description": "Exchange pieces positions" },
        { "name": "Extinction", "description": "Capture all of a kind" },
        { "name": "Ultima", "description": "Non-standard captures" },
-       { "name": "Half", "description": "Small board" },
 ];
diff --git a/views/rules/Half.pug b/views/rules/Half.pug
deleted file mode 100644 (file)
index 91b4a4e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-p.boxed
-       | 4x8 board with no pawns. Orthodox rules.
-
-figure.diagram-container
-       .diagram
-               | fen:rn4NR/kb4BK/qb4BQ/rn4NR:
-       figcaption Initial position (non-random)
-
-h3 Specifications
-
-ul
-       li Chessboard: 4x8 (see diagram).
-       li Material: no pawns.
-       li Non-capturing moves: standard.
-       li Special moves: none.
-       li Captures: standard.
-       li End of game: standard.
-
-h3 Credits
-
-p
-       | This variant is shortly described on 
-       a(href="https://www.chessvariants.com/small.dir/halfchess.html") chessvariants.com
-       | .