From 34bfe15106aab64346f549420f066fe72441172f Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> 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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="67px" + id="Layer_1" + style="enable-background:new 0 0 67 67;" + version="1.1" + viewBox="0 0 67 67" + width="67px" + xml:space="preserve" + sodipodi:docname="facebook.svg" + inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><metadata + id="metadata9"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs + id="defs7" /><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1060" + id="namedview5" + showgrid="false" + inkscape:zoom="4.981409" + inkscape:cx="34.067797" + inkscape:cy="33.5" + inkscape:window-x="0" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:current-layer="Layer_1" /><path + d="m 28.909296,51.384204 h 7.4184 v -17.9542 h 4.9489 l 0.6556,-6.1864 h -5.6045 l 0.0077,-3.0976 c 0,-1.6126 0.154,-2.4783 2.4684,-2.4783 h 3.0932 v -6.1875 h -4.95 c -5.9455,0 -8.0377,3.0019 -8.0377,8.0487 v 3.7147 h -3.7059 v 6.1875 h 3.7059 z m 4.6585,15.048 c -18.2248,0 -32.99999938,-14.7752 -32.99999938,-33 0,-18.2259 14.77519938,-33.00000062 32.99999938,-33.00000062 18.2248,0 33,14.77410062 33,33.00000062 0,18.2248 -14.7752,33 -33,33 z" + style="clip-rule:evenodd;fill:#010101;fill-rule:evenodd;stroke-width:1.10000002" + id="path2" + inkscape:connector-curvature="0" /></svg> \ 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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + enable-background="new 0 0 56.693 56.693" + height="56.693px" + id="Layer_1" + version="1.1" + viewBox="0 0 56.693 56.693" + width="56.693px" + xml:space="preserve" + sodipodi:docname="twitter.svg" + inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><metadata + id="metadata9"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs + id="defs7" /><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1060" + id="namedview5" + showgrid="false" + inkscape:zoom="8.3255427" + inkscape:cx="28.82695" + inkscape:cy="28.3465" + inkscape:window-x="0" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:current-layer="Layer_1" /><path + d="m 28.468253,0.38840479 c -15.504,0 -28.07250072,12.57078021 -28.07250072,28.07250021 0,15.504 12.56850072,28.07022 28.07250072,28.07022 15.504,0 28.07022,-12.56622 28.07022,-28.07022 0,-15.50172 -12.56736,-28.07250021 -28.07022,-28.07250021 z M 42.608813,22.800805 c 0.01482,0.30324 0.02052,0.60762 0.02052,0.91542 0,9.34914 -7.11588,20.12784 -20.12784,20.12784 -3.99456,0 -7.71438,-1.17078 -10.84482,-3.17718 0.55404,0.06498 1.11606,0.09804 1.6872,0.09804 3.31512,0 6.36576,-1.13088 8.78598,-3.02784 -3.0951,-0.05814 -5.70684,-2.10444 -6.60744,-4.91454 0.43092,0.08436 0.87438,0.12654 1.33038,0.12654 0.64524,0 1.26996,-0.08436 1.8639,-0.24738 -3.2376,-0.6498 -5.67606,-3.5112 -5.67606,-6.93576 0,-0.03078 0,-0.06042 0.0011,-0.0912 0.95304,0.5301 2.04402,0.84816 3.20454,0.88578 -1.89924,-1.2711 -3.14754,-3.43368 -3.14754,-5.88924 0,-1.29618 0.34884,-2.51256 0.9576,-3.5568 3.48954,4.27956 8.70276,7.0965 14.58288,7.39062 -0.12084,-0.51642 -0.18354,-1.05792 -0.18354,-1.61196 0,-3.90564 3.16692,-7.0737 7.07484,-7.0737 2.0349,0 3.87258,0.85956 5.16306,2.23326 1.61196,-0.31578 3.12588,-0.9063 4.49274,-1.71684 -0.5301,1.653 -1.65072,3.03924 -3.1122,3.91362 1.43298,-0.171 2.79642,-0.55176 4.0641,-1.11378 -0.9462,1.42158 -2.14662,2.6676 -3.52944,3.6651 z" + id="path2" + inkscape:connector-curvature="0" + style="stroke-width:1.13999999" /></svg> \ 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"] }} </template> @@ -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