From 34bfe15106aab64346f549420f066fe72441172f Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Wed, 29 Apr 2020 23:05:40 +0200 Subject: [PATCH] Add FB and Twitter links on main page. Only icons, no text for Discord + Github as well --- client/public/images/icons/SOURCE | 2 + client/public/images/icons/facebook.svg | 45 ++++++++++ client/public/images/icons/twitter.svg | 45 ++++++++++ client/src/App.vue | 16 ++-- client/src/base_rules.js | 1 + client/src/translations/en.js | 1 - client/src/translations/es.js | 1 - client/src/translations/fr.js | 1 - client/src/translations/rules/Kinglet/en.pug | 1 + client/src/translations/rules/Kinglet/es.pug | 1 + client/src/translations/rules/Kinglet/fr.pug | 1 + client/src/variants/Doublemove2.js | 2 +- client/src/variants/Kinglet.js | 87 ++++++++++++++++++++ client/src/variants/Monster.js | 2 +- 14 files changed, 196 insertions(+), 10 deletions(-) create mode 100644 client/public/images/icons/facebook.svg create mode 100644 client/public/images/icons/twitter.svg create mode 100644 client/src/translations/rules/Kinglet/en.pug create mode 100644 client/src/translations/rules/Kinglet/es.pug create mode 100644 client/src/translations/rules/Kinglet/fr.pug create mode 100644 client/src/variants/Kinglet.js diff --git a/client/public/images/icons/SOURCE b/client/public/images/icons/SOURCE index 2946454f..6fb5c788 100644 --- a/client/public/images/icons/SOURCE +++ b/client/public/images/icons/SOURCE @@ -18,3 +18,5 @@ https://iconscout.com/icon/discord-1 https://www.onlinewebfonts.com/icon/154680 https://www.flaticon.com/free-icon/bleach_481058?term=triangle&page=1&position=2 https://www.onlinewebfonts.com/icon/89755 +https://www.iconfinder.com/icons/107153/circle_facebook_icon +https://www.iconfinder.com/icons/104461/twitter_icon diff --git a/client/public/images/icons/facebook.svg b/client/public/images/icons/facebook.svg new file mode 100644 index 00000000..434e1011 --- /dev/null +++ b/client/public/images/icons/facebook.svg @@ -0,0 +1,45 @@ + +image/svg+xml \ No newline at end of file diff --git a/client/public/images/icons/twitter.svg b/client/public/images/icons/twitter.svg new file mode 100644 index 00000000..8d89c77b --- /dev/null +++ b/client/public/images/icons/twitter.svg @@ -0,0 +1,45 @@ + +image/svg+xml \ No newline at end of file diff --git a/client/src/App.vue b/client/src/App.vue index 5729c380..db6170b5 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -35,11 +35,13 @@ router-link.menuitem(to="/about") {{ st.tr["About"] }} router-link.menuitem(to="/faq") F.A.Q. a.menuitem(href="https://discord.gg/a9ZFKBe") - span Discord - img(src="/images/icons/discord.svg") + img.first(src="/images/icons/discord.svg") a.menuitem(href="https://github.com/yagu0/vchess") - span {{ st.tr["Code"] }} img(src="/images/icons/github.svg") + a.menuitem(href="https://www.facebook.com/Variants-Chess-Club-112565840437886") + img(src="/images/icons/facebook.svg") + a.menuitem(href="https://twitter.com/VchessC") + img.last(src="/images/icons/twitter.svg") p.clickable(onClick="window.doClick('modalContact')") | {{ st.tr["Contact"] }} @@ -267,9 +269,13 @@ footer color: #2c3e50 text-decoration: none & > img - height: 1.2em + height: 1.5em display: inline-block - margin-left: 5px + margin: 0 + &.first + margin-left: 5px + &.last + margin-right: 5px & > p display: inline-block margin: 0 12px diff --git a/client/src/base_rules.js b/client/src/base_rules.js index d2bd30ad..e0353e8f 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -917,6 +917,7 @@ export const ChessRules = class ChessRules { if ( // NOTE: "castling" arg is used by some variants (Monster), // where "isAttacked" is overloaded in an infinite-recursive way. + // TODO: not used anymore (Monster + Doublemove2 are simplified). (!castleInCheck && this.isAttacked([x, i], oppCol, "castling")) || (this.board[x][i] != V.EMPTY && // NOTE: next check is enough, because of chessboard constraints diff --git a/client/src/translations/en.js b/client/src/translations/en.js index 909a3e35..b80bc282 100644 --- a/client/src/translations/en.js +++ b/client/src/translations/en.js @@ -28,7 +28,6 @@ export const translations = { "Challenge declined": "Challenge declined", "Chat here": "Chat here", "Clear history": "Clear history", - Code: "Code", "Connection token sent. Check your emails!": "Connection token sent. Check your emails!", Contact: "Contact", "Correspondance challenges": "Correspondance challenges", diff --git a/client/src/translations/es.js b/client/src/translations/es.js index 08aa2449..5c308d9a 100644 --- a/client/src/translations/es.js +++ b/client/src/translations/es.js @@ -28,7 +28,6 @@ export const translations = { "Challenge declined": "Desafío rechazado", "Chat here": "Chat aquí", "Clear history": "Clara historia", - Code: "Código", "Connection token sent. Check your emails!": "Token de conexión enviado. ¡Revisa tus correos!", Contact: "Contacto", "Correspondance challenges": "Desafíos por correspondencia", diff --git a/client/src/translations/fr.js b/client/src/translations/fr.js index f14632e3..e10a9f58 100644 --- a/client/src/translations/fr.js +++ b/client/src/translations/fr.js @@ -28,7 +28,6 @@ export const translations = { "Challenge declined": "Défi refusé", "Chat here": "Chattez ici", "Clear history": "Effacer l'historique", - Code: "Code", "Connection token sent. Check your emails!": "Token de connection envoyé. Allez voir vos emails !", Contact: "Contact", "Correspondance challenges": "Défis par correspondance", diff --git a/client/src/translations/rules/Kinglet/en.pug b/client/src/translations/rules/Kinglet/en.pug new file mode 100644 index 00000000..21203baa --- /dev/null +++ b/client/src/translations/rules/Kinglet/en.pug @@ -0,0 +1 @@ +p.boxed TODO diff --git a/client/src/translations/rules/Kinglet/es.pug b/client/src/translations/rules/Kinglet/es.pug new file mode 100644 index 00000000..21203baa --- /dev/null +++ b/client/src/translations/rules/Kinglet/es.pug @@ -0,0 +1 @@ +p.boxed TODO diff --git a/client/src/translations/rules/Kinglet/fr.pug b/client/src/translations/rules/Kinglet/fr.pug new file mode 100644 index 00000000..21203baa --- /dev/null +++ b/client/src/translations/rules/Kinglet/fr.pug @@ -0,0 +1 @@ +p.boxed TODO diff --git a/client/src/variants/Doublemove2.js b/client/src/variants/Doublemove2.js index 080d13b6..7f3f6cec 100644 --- a/client/src/variants/Doublemove2.js +++ b/client/src/variants/Doublemove2.js @@ -79,7 +79,7 @@ export class Doublemove2Rules extends ChessRules { return moves; } - isAttacked(sq, color) { + isAttacked() { // Goal is king capture => no checks return false; } diff --git a/client/src/variants/Kinglet.js b/client/src/variants/Kinglet.js new file mode 100644 index 00000000..38ca6492 --- /dev/null +++ b/client/src/variants/Kinglet.js @@ -0,0 +1,87 @@ +import { ChessRules } from "@/base_rules"; +import { SuicideRules } from "@/variants/Suicide"; + +export class KingletRules extends ChessRules { + static get HasFlags() { + return false; + } + + static get PawnSpecs() { + return Object.assign( + {}, + ChessRules.PawnSpecs, + { promotions: [V.KING] } + ); + } + + static IsGoodPosition(position) { + if (position.length == 0) return false; + const rows = position.split("/"); + if (rows.length != V.size.x) return false; + // Just check that at least one pawn of each color is there: + let pawns = { "w": 0, "b": 0 }; + for (let row of rows) { + let sumElts = 0; + for (let i = 0; i < row.length; i++) { + const lowerRi = row[i].toLowerCase(); + if (V.PIECES.includes(lowerRi)) { + if (lowerRi == 'p') pawns[row[i] == lowerRi ? "b" : "w"]++; + sumElts++; + } else { + const num = parseInt(row[i]); + if (isNaN(num)) return false; + sumElts += num; + } + } + if (sumElts != V.size.y) return false; + } + if (Object.values(pawns).some(v => v == 0)) return false; + return true; + } + + scanKings() {} + + filterValid(moves) { + return moves; + } + + getCheckSquares() { + return []; + } + + // No variables update because no royal king + no castling + prePlay() {} + postPlay() {} + preUndo() {} + postUndo() {} + + getCurrentScore() { + const pawnRemain = { + 'w': this.board.some(b => + b.some(cell => cell[0] == 'w' && cell[1] == 'p')), + 'b': this.board.some(b => + b.some(cell => cell[0] == 'b' && cell[1] == 'p')) + } + if (!pawnRemain['w']) return "0-1"; + if (!pawnRemain['b']) return "1-0"; + if (this.atLeastOneMove()) return "*"; + // Stalemate: draw + return "1/2"; + } + + static GenRandInitFen(randomness) { + return SuicideRules.GenRandInitFen(randomness); + } + + static get VALUES() { + // TODO: no clue what correct values would be + return { + p: 5, + r: 4, + n: 3, + b: 3, + q: 7, + k: 4 + }; + } +}; diff --git a/client/src/variants/Monster.js b/client/src/variants/Monster.js index 071c8db0..399bc112 100644 --- a/client/src/variants/Monster.js +++ b/client/src/variants/Monster.js @@ -45,7 +45,7 @@ export class MonsterRules extends ChessRules { ); } - isAttacked(sq, color, castling) { + isAttacked() { // Goal is king capture => no checks return false; } -- 2.44.0