Add FB and Twitter links on main page. Only icons, no text for Discord + Github as...
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 29 Apr 2020 21:05:40 +0000 (23:05 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 29 Apr 2020 21:05:40 +0000 (23:05 +0200)
14 files changed:
client/public/images/icons/SOURCE
client/public/images/icons/facebook.svg [new file with mode: 0644]
client/public/images/icons/twitter.svg [new file with mode: 0644]
client/src/App.vue
client/src/base_rules.js
client/src/translations/en.js
client/src/translations/es.js
client/src/translations/fr.js
client/src/translations/rules/Kinglet/en.pug [new file with mode: 0644]
client/src/translations/rules/Kinglet/es.pug [new file with mode: 0644]
client/src/translations/rules/Kinglet/fr.pug [new file with mode: 0644]
client/src/variants/Doublemove2.js
client/src/variants/Kinglet.js [new file with mode: 0644]
client/src/variants/Monster.js

index 2946454..6fb5c78 100644 (file)
@@ -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 (file)
index 0000000..434e101
--- /dev/null
@@ -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 (file)
index 0000000..8d89c77
--- /dev/null
@@ -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
index 5729c38..db6170b 100644 (file)
         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
index d2bd30a..e0353e8 100644 (file)
@@ -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
index 909a3e3..b80bc28 100644 (file)
@@ -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",
index 08aa244..5c308d9 100644 (file)
@@ -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",
index f14632e..e10a9f5 100644 (file)
@@ -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 (file)
index 0000000..21203ba
--- /dev/null
@@ -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 (file)
index 0000000..21203ba
--- /dev/null
@@ -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 (file)
index 0000000..21203ba
--- /dev/null
@@ -0,0 +1 @@
+p.boxed TODO
index 080d13b..7f3f6ce 100644 (file)
@@ -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 (file)
index 0000000..38ca649
--- /dev/null
@@ -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
+    };
+  }
+};
index 071c8db..399bc11 100644 (file)
@@ -45,7 +45,7 @@ export class MonsterRules extends ChessRules {
     );
   }
 
-  isAttacked(sq, color, castling) {
+  isAttacked() {
     // Goal is king capture => no checks
     return false;
   }