From: Benjamin Auder Date: Tue, 24 Nov 2020 20:28:55 +0000 (+0100) Subject: Fix typo X-Git-Url: https://git.auder.net/doc/html/assets/current/%7B%7B%20targetUrl%20%7D%7D?a=commitdiff_plain;h=31c535953c843b28434a7fcdf7b4da0b376774ab;p=vchess.git Fix typo --- diff --git a/client/src/translations/es.js b/client/src/translations/es.js index 16684723..8afb92cf 100644 --- a/client/src/translations/es.js +++ b/client/src/translations/es.js @@ -17,7 +17,7 @@ export const translations = { Black: "Negras", "Black to move": "Juegan las negras", "Black surrender": "Las negras abandonan", - "Black win": "Las negras gagnan", + "Black win": "Las negras ganan", "Board colors": "Colores del tablero", "Board size": "Tamaño del tablero", blue: "azul", @@ -153,7 +153,7 @@ export const translations = { White: "Blancas", "White to move": "Juegan las blancas", "White surrender": "Las blancas abandonan", - "White win": "Las blancas gagnan", + "White win": "Las blancas ganan", "Who's there?": "¿Quién está ahí?", With: "Con", with: "con", diff --git a/client/src/variants/Titan.js b/client/src/variants/Titan.js index 9e147cd3..2ed54992 100644 --- a/client/src/variants/Titan.js +++ b/client/src/variants/Titan.js @@ -5,39 +5,74 @@ export class TitanRules extends ChessRules { // and, red = bishop + purple = knight (black side) // (avoid using a bigger board, or complicated drawings) - // TODO: decode if piece + bishop or knight - getPiece() {} + // Decode if normal piece, or + bishop or knight + getPiece(i, j) { + const piece = this.board[i][j].charAt(1); + if (ChessRules.PIECES.includes(piece)) return piece; + // Augmented piece: + switch (piece) { + case 'a': + case 'c': + return 'b'; + case 'j': + case 'l': + return 'k'; + case 'm': + case 'o': + return 'n'; + case 's': + case 't': + return 'q'; + case 'u': + case 'v': + return 'r'; + } + } + + // TODO: subtelty, castle forbidden if // Code: a/c = bishop + knight/bishop j/l for king, // m/o for knight, s/t for queen, u/v for rook static get AUGMENTED_PIECES() { - return { - // ... - }; + return [ + 'a', + 'c', + 'j', + 'l', + 'm', + 'o', + 's', + 't', + 'u', + 'v' + ]; } - // or: + + // Decode above notation into additional piece getExtraPiece(symbol) { - // TODO: switch ... case ... return b or n + if (['a','j','m','s','u'].includes(symbol)) + return 'n'; + return 'b'; } - // TODO: hook after any move from 1st rank, - // if piece not in usual list, bishop or knight appears. - getPotentialMovesFrom(sq) { + // If piece not in usual list, bishop or knight appears. + getPotentialMovesFrom([x, y]) { let moves = super.getPotentialMovesFrom(sq); const color = this.turn; + +// treat castle case here (both pieces appear!) if ( - !ChessRules.PIECES.includes(this.board[sq[0]][sq[1]][1]) && - ((color == 'w' && sq[0] == 7) || (color == "b" && sq[0] == 0)) + V.AUGMENTED_PIECES.includes(this.board[x][y][1]) && + ((color == 'w' && x == 7) || (color == "b" && x == 0)) ) { - // (or lookup table) - const newPiece = this.getExtraPiece(this.board[sq[0]][sq[1]][1]) + const newPiece = this.getExtraPiece(this.board[x][y][1]); moves.forEach(m => { m.appear.push( new PiPo({ p: newPiece, c: color, - x: sq[0], - y: sq[1] + x: x, + y: y }) ); });