From 90df90bca1a993930a0e1a07a1b4990dd538c6e2 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Wed, 22 Apr 2020 23:54:39 +0200 Subject: [PATCH] Some thoughts on Chakart + fix Hiddenqueen moves notation + better moveslist display --- TODO | 5 - client/public/images/pieces/Chakart/SOURCE | 5 + client/public/images/pieces/Chakart/ab.svg | 5 + client/public/images/pieces/Chakart/ae.svg | 73 +++++++ client/public/images/pieces/Chakart/am.svg | 56 +++++ client/public/images/pieces/Chakart/an.svg | 125 +++++++++++ client/public/images/pieces/Chakart/bc.svg | 94 ++++++++ client/public/images/pieces/Chakart/bl.svg | 119 ++++++++++ client/public/images/pieces/Chakart/bo.svg | 99 +++++++++ client/public/images/pieces/Chakart/bs.svg | 62 ++++++ client/public/images/pieces/Chakart/bt.svg | 109 ++++++++++ client/public/images/pieces/Chakart/bu.svg | 94 ++++++++ client/public/images/pieces/Chakart/wc.svg | 126 +++++++++++ client/public/images/pieces/Chakart/wl.svg | 124 +++++++++++ client/public/images/pieces/Chakart/wo.svg | 71 ++++++ client/public/images/pieces/Chakart/ws.svg | 71 ++++++ client/public/images/pieces/Chakart/wt.svg | 204 ++++++++++++++++++ client/public/images/pieces/Chakart/wu.svg | 128 +++++++++++ client/public/images/pieces/Colorbound/ba.svg | 141 ++---------- client/public/images/pieces/Colorbound/bh.svg | 141 ++++++++++-- client/public/images/pieces/Colorbound/wa.svg | 187 +++------------- client/public/images/pieces/Colorbound/wh.svg | 187 +++++++++++++--- client/src/base_rules.js | 5 + client/src/components/Board.vue | 7 +- client/src/components/MoveList.vue | 33 ++- client/src/translations/en.js | 1 + client/src/translations/es.js | 1 + client/src/translations/fr.js | 1 + client/src/translations/rules/Chakart/en.pug | 2 + client/src/translations/rules/Chakart/es.pug | 2 + client/src/translations/rules/Chakart/fr.pug | 2 + client/src/variants/Chakart.js | 81 ++++--- client/src/variants/Hamilton.js | 4 + client/src/variants/Hiddenqueen.js | 20 +- client/src/variants/Teleport.js | 5 + server/db/populate.sql | 1 + 36 files changed, 2007 insertions(+), 384 deletions(-) create mode 100644 client/public/images/pieces/Chakart/SOURCE create mode 100644 client/public/images/pieces/Chakart/ab.svg create mode 100644 client/public/images/pieces/Chakart/ae.svg create mode 100644 client/public/images/pieces/Chakart/am.svg create mode 100644 client/public/images/pieces/Chakart/an.svg create mode 100644 client/public/images/pieces/Chakart/bc.svg create mode 100644 client/public/images/pieces/Chakart/bl.svg create mode 100644 client/public/images/pieces/Chakart/bo.svg create mode 100644 client/public/images/pieces/Chakart/bs.svg create mode 100644 client/public/images/pieces/Chakart/bt.svg create mode 100644 client/public/images/pieces/Chakart/bu.svg create mode 100644 client/public/images/pieces/Chakart/wc.svg create mode 100644 client/public/images/pieces/Chakart/wl.svg create mode 100644 client/public/images/pieces/Chakart/wo.svg create mode 100644 client/public/images/pieces/Chakart/ws.svg create mode 100644 client/public/images/pieces/Chakart/wt.svg create mode 100644 client/public/images/pieces/Chakart/wu.svg create mode 100644 client/src/translations/rules/Chakart/en.pug create mode 100644 client/src/translations/rules/Chakart/es.pug create mode 100644 client/src/translations/rules/Chakart/fr.pug diff --git a/TODO b/TODO index a31fd7aa..c525e789 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,6 @@ Issue: embedded rules language not updated when language is set (in Analyse, Game and Problems) Also: if new live game starts in background, "new game" notify OK but not first move (not too serious however) -For Teleport, Chakart and Hamilton at least: a piece should be attached to mouse cursor, -waiting for a click dropping it somewhere. In BaseGame: find the appropriate place to call eg. Board::setHoverPiece(), -which should be in effect when hovering over position only (#gamePosition), and cancelled when receiving the -message stopHover() for example. - https://www.chessvariants.com/crossover.dir/koopachess.html --> Can a stunned piece capture? Maybe not. ...recover? After 5 moves? Never? + Chakart :) diff --git a/client/public/images/pieces/Chakart/SOURCE b/client/public/images/pieces/Chakart/SOURCE new file mode 100644 index 00000000..988a2a3d --- /dev/null +++ b/client/public/images/pieces/Chakart/SOURCE @@ -0,0 +1,5 @@ +Objects were found here: +https://fr.m.wikiversity.org/wiki/Fichier:Tango_Style_Mushroom_icon.svg +https://commons.wikimedia.org/wiki/File:Tux_Paint_banana.svg +https://fr.wikipedia.org/wiki/Fichier:Font_Awesome_5_solid_bomb.svg +https://www.svgrepo.com/svg/264673/easter-egg-easter diff --git a/client/public/images/pieces/Chakart/ab.svg b/client/public/images/pieces/Chakart/ab.svg new file mode 100644 index 00000000..63e70e3c --- /dev/null +++ b/client/public/images/pieces/Chakart/ab.svg @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/client/public/images/pieces/Chakart/ae.svg b/client/public/images/pieces/Chakart/ae.svg new file mode 100644 index 00000000..e9c6df63 --- /dev/null +++ b/client/public/images/pieces/Chakart/ae.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/am.svg b/client/public/images/pieces/Chakart/am.svg new file mode 100644 index 00000000..3fb5ad3c --- /dev/null +++ b/client/public/images/pieces/Chakart/am.svg @@ -0,0 +1,56 @@ + + + + + + + image/svg+xml + + Tango Style 'Shroom + + + Andrew Higginson + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/an.svg b/client/public/images/pieces/Chakart/an.svg new file mode 100644 index 00000000..f51de6f1 --- /dev/null +++ b/client/public/images/pieces/Chakart/an.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Clipart by Nicu Buculei - pear + + + Nicu Buculei + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/bc.svg b/client/public/images/pieces/Chakart/bc.svg new file mode 100644 index 00000000..03c42738 --- /dev/null +++ b/client/public/images/pieces/Chakart/bc.svg @@ -0,0 +1,94 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/bl.svg b/client/public/images/pieces/Chakart/bl.svg new file mode 100644 index 00000000..965d8dec --- /dev/null +++ b/client/public/images/pieces/Chakart/bl.svg @@ -0,0 +1,119 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/bo.svg b/client/public/images/pieces/Chakart/bo.svg new file mode 100644 index 00000000..a3e425a5 --- /dev/null +++ b/client/public/images/pieces/Chakart/bo.svg @@ -0,0 +1,99 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/bs.svg b/client/public/images/pieces/Chakart/bs.svg new file mode 100644 index 00000000..fab7c213 --- /dev/null +++ b/client/public/images/pieces/Chakart/bs.svg @@ -0,0 +1,62 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/bt.svg b/client/public/images/pieces/Chakart/bt.svg new file mode 100644 index 00000000..311d5fd7 --- /dev/null +++ b/client/public/images/pieces/Chakart/bt.svg @@ -0,0 +1,109 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/bu.svg b/client/public/images/pieces/Chakart/bu.svg new file mode 100644 index 00000000..bce3eed1 --- /dev/null +++ b/client/public/images/pieces/Chakart/bu.svg @@ -0,0 +1,94 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/wc.svg b/client/public/images/pieces/Chakart/wc.svg new file mode 100644 index 00000000..b51dea5a --- /dev/null +++ b/client/public/images/pieces/Chakart/wc.svg @@ -0,0 +1,126 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/wl.svg b/client/public/images/pieces/Chakart/wl.svg new file mode 100644 index 00000000..322c54c3 --- /dev/null +++ b/client/public/images/pieces/Chakart/wl.svg @@ -0,0 +1,124 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/wo.svg b/client/public/images/pieces/Chakart/wo.svg new file mode 100644 index 00000000..0e3bd47e --- /dev/null +++ b/client/public/images/pieces/Chakart/wo.svg @@ -0,0 +1,71 @@ + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/ws.svg b/client/public/images/pieces/Chakart/ws.svg new file mode 100644 index 00000000..dfcd791e --- /dev/null +++ b/client/public/images/pieces/Chakart/ws.svg @@ -0,0 +1,71 @@ + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/wt.svg b/client/public/images/pieces/Chakart/wt.svg new file mode 100644 index 00000000..e2a5a230 --- /dev/null +++ b/client/public/images/pieces/Chakart/wt.svg @@ -0,0 +1,204 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Chakart/wu.svg b/client/public/images/pieces/Chakart/wu.svg new file mode 100644 index 00000000..b2bfd221 --- /dev/null +++ b/client/public/images/pieces/Chakart/wu.svg @@ -0,0 +1,128 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Colorbound/ba.svg b/client/public/images/pieces/Colorbound/ba.svg index 9d51bfc9..e11fbadf 100644 --- a/client/public/images/pieces/Colorbound/ba.svg +++ b/client/public/images/pieces/Colorbound/ba.svg @@ -17,7 +17,7 @@ viewBox="0 0 50 50" version="1.1" id="svg974" - sodipodi:docname="ba.svg" + sodipodi:docname="bh.svg" inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"> @@ -45,8 +45,8 @@ id="namedview976" showgrid="false" inkscape:zoom="2.3931818" - inkscape:cx="11.490991" - inkscape:cy="50.539966" + inkscape:cx="-24.258144" + inkscape:cy="55.343366" inkscape:window-x="0" inkscape:window-y="20" inkscape:window-maximized="0" @@ -124,124 +124,29 @@ + id="g14601" + transform="matrix(0.95,0,0,0.95,79.104503,1.6608693)"> + + id="path14591" + d="M -76.54764,4.8052049 -36.856271,44.496574" + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.69328892;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + - - - - + id="path14595" + d="M -57.035497,4.3882787 -77.047951,24.400734 -56.701955,44.746729 -37.106426,25.151201 Z" + style="fill:none;stroke:#ffffff;stroke-width:1.69328892;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - - - - - diff --git a/client/public/images/pieces/Colorbound/bh.svg b/client/public/images/pieces/Colorbound/bh.svg index e11fbadf..9d51bfc9 100644 --- a/client/public/images/pieces/Colorbound/bh.svg +++ b/client/public/images/pieces/Colorbound/bh.svg @@ -17,7 +17,7 @@ viewBox="0 0 50 50" version="1.1" id="svg974" - sodipodi:docname="bh.svg" + sodipodi:docname="ba.svg" inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"> @@ -45,8 +45,8 @@ id="namedview976" showgrid="false" inkscape:zoom="2.3931818" - inkscape:cx="-24.258144" - inkscape:cy="55.343366" + inkscape:cx="11.490991" + inkscape:cy="50.539966" inkscape:window-x="0" inkscape:window-y="20" inkscape:window-maximized="0" @@ -124,29 +124,124 @@ - + id="g5357" + style="opacity:1;fill:#1f1a17;fill-opacity:1" + transform="matrix(0.84130849,0,0,0.84130849,-76.526422,18.776438)"> - + id="path5349" + d="m 119.66608,20.578823 c 0.12511,0.773672 0.40427,1.44388 1.3,1.7 11.23011,-0.424319 16.82956,-5.233235 20.30001,-11.7 l 0.2,-2.099999 c -2.10707,-8.89280401 -8.15113,-13.4502442 -16.2,-15.8 -4.40015,-0.5317426 -7.59668,1.3815851 -10.20001,4.5 -2.59354,2.64077835 -4.39616,5.9439949 -5.3,10 -0.9084,3.60641 -5.79067,1.6990508 -4.9,-0.6 2.76583,-4.0566968 11.00069,-10.7605086 4.9,-12.3 -8.75831,-2.0518262 -7.05798,4.7061225 -5.2,6.20000004 1.23982,-0.5457366 2.00197,-1.22280981 2.4,-2.00000004 -0.25951,-0.4357328 -0.98217,-0.8162564 0,-1.4 0.5387,0.045976 0.81918,0.2856122 1,0.6 0,1 0.50403,1.1455069 -3.6,4 -7.640521,5.2325602 -3.73403,16.328533 2.94302,17.405035 2.93812,0.458135 3.4042,1.08673 5.28907,0.933469 0.49515,-0.04026 1.25166,0.522864 1.96791,0.561495 0.84449,-0.337075 4.5865,-0.641651 3.83596,-0.600198 0.37015,0.007 0.83701,-0.226033 1.09094,-0.03707 0.11828,0.08802 0.12726,0.435864 0.1731,0.637268 z" + style="fill:#1f1a17;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + id="path5353" + d="m 109.56608,17.578823 c -1.32838,4.066443 -4.04985,6.321863 -6.6,8.8 -0.20576,0.304421 0.14574,0.397532 1,0.3 3.90473,-1.863513 6.85963,-4.360243 8.1,-8 -0.78642,-0.41302 -1.31194,-1.08384 -2.5,-1.1 z" + style="fill:#1f1a17;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + + + + + + + + + + + + diff --git a/client/public/images/pieces/Colorbound/wa.svg b/client/public/images/pieces/Colorbound/wa.svg index 0e249758..4c993056 100644 --- a/client/public/images/pieces/Colorbound/wa.svg +++ b/client/public/images/pieces/Colorbound/wa.svg @@ -17,7 +17,7 @@ viewBox="0 0 50 50" version="1.1" id="svg974" - sodipodi:docname="wWaffle.svg" + sodipodi:docname="wFAD.svg" inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"> @@ -44,28 +44,17 @@ inkscape:window-height="1060" id="namedview976" showgrid="false" - inkscape:zoom="2.3931818" - inkscape:cx="8.4123423" - inkscape:cy="122.97195" + inkscape:zoom="1.6922351" + inkscape:cx="-130.52172" + inkscape:cy="183.98903" inkscape:window-x="0" inkscape:window-y="20" inkscape:window-maximized="0" inkscape:current-layer="svg974" - showguides="false" /> + showguides="false" + inkscape:snap-nodes="false" /> - - - - @@ -133,153 +122,31 @@ stop-opacity="0" id="stop3287" /> - - - - - + id="g14601" + transform="matrix(0.95,0,0,0.95,79.104503,1.6608693)"> - - - - - - - - - - - - + y="1.9701072" + x="-79.549507" + height="45.194798" + width="45.194798" + id="rect14589" + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#1f1a17;stroke-width:1.5555681;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal" /> + + + id="path14595" + d="M -57.035497,4.3882787 -77.047951,24.400734 -56.701955,44.746729 -37.106426,25.151201 Z" + style="fill:none;stroke:#1f1a17;stroke-width:1.69328892;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - diff --git a/client/public/images/pieces/Colorbound/wh.svg b/client/public/images/pieces/Colorbound/wh.svg index 4c993056..0e249758 100644 --- a/client/public/images/pieces/Colorbound/wh.svg +++ b/client/public/images/pieces/Colorbound/wh.svg @@ -17,7 +17,7 @@ viewBox="0 0 50 50" version="1.1" id="svg974" - sodipodi:docname="wFAD.svg" + sodipodi:docname="wWaffle.svg" inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"> @@ -44,17 +44,28 @@ inkscape:window-height="1060" id="namedview976" showgrid="false" - inkscape:zoom="1.6922351" - inkscape:cx="-130.52172" - inkscape:cy="183.98903" + inkscape:zoom="2.3931818" + inkscape:cx="8.4123423" + inkscape:cy="122.97195" inkscape:window-x="0" inkscape:window-y="20" inkscape:window-maximized="0" inkscape:current-layer="svg974" - showguides="false" - inkscape:snap-nodes="false" /> + showguides="false" /> + + + + @@ -122,31 +133,153 @@ stop-opacity="0" id="stop3287" /> + + + + + + transform="matrix(0.95,0,0,0.95,1.1939867,1.6421008)" + id="g14577"> - - + y="4.245285" + x="23.113207" + height="40.212261" + width="3.7735846" + id="rect14571" + style="opacity:1;fill:#1f1a17;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.69328892;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal" /> + + + + + + + + + + + + + id="path3879" + d="m 17.809955,22.804124 c -0.364,-0.186 -0.542,-0.279 -0.542,-0.279 -0.499,-0.195 -0.652,-0.559 -0.474,-1.092 0.195,-0.491 0.576,-0.66 1.143,-0.491 1.947,0.711 3.294,2.02 4.04,3.92 0.118,0.542 -0.076,0.914 -0.592999,1.118 -0.516001,0.161 -0.864001,-0.017 -1.041001,-0.55 -0.136,-0.279 -0.229,-0.466 -0.296,-0.542 -0.186,0.144 -0.423,0.245 -0.72,0.296 -1.01,0.161 -1.6,-0.279 -1.761,-1.338 -0.051,-0.364 0.034,-0.711 0.246,-1.041" + style="fill:#000000;stroke-width:1" /> + + + diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 99de6265..1795b5fa 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -117,6 +117,11 @@ export const ChessRules = class ChessRules { return null; } + // Some variants may need to highlight squares on hover (Hamilton, Weiqi...) + hoverHighlight() { + return false; + } + static get IMAGE_EXTENSION() { // All pieces should be in the SVG format return ".svg"; diff --git a/client/src/components/Board.vue b/client/src/components/Board.vue index 5a21771d..4305280b 100644 --- a/client/src/components/Board.vue +++ b/client/src/components/Board.vue @@ -188,7 +188,8 @@ export default { "incheck-light": showCheck && lightSquare && incheckSq[ci][cj], "incheck-dark": - showCheck && !lightSquare && incheckSq[ci][cj] + showCheck && !lightSquare && incheckSq[ci][cj], + "hover-highlight": this.vr.hoverHighlight(ci, cj) }, attrs: { id: getSquareId({ x: ci, y: cj }) @@ -901,6 +902,10 @@ img.ghost // TODO: no predefined highlight colors, but layers. How? +.hover-highlight:hover + // TODO: color dependant on board theme, or inner border... + background-color: #C571E6 + .light-square.lichess.highlight-light background-color: #cdd26a .dark-square.lichess.highlight-dark diff --git a/client/src/components/MoveList.vue b/client/src/components/MoveList.vue index 9ec968f8..2fc7bacb 100644 --- a/client/src/components/MoveList.vue +++ b/client/src/components/MoveList.vue @@ -46,20 +46,20 @@ div #scoreInfo(v-if="score!='*'") span.score {{ score }} span.score-msg {{ st.tr[message] }} - .moves-list(v-if="!['none','highlight'].includes(show)") + .moves-list .tr(v-for="moveIdx in evenNumbers") .td {{ firstNum + moveIdx / 2 }} - .td(v-if="moveIdx < moves.length-1 || show == 'all'" + .td( :class="{'highlight-lm': cursor == moveIdx}" @click="() => gotoMove(moveIdx)" ) - | {{ notation(moves[moveIdx]) }} + | {{ notation(moveIdx) }} .td( v-if="moveIdx < moves.length-1" - :class="{'highlight-lm': highlightBlackmove(moveIdx+1)}" + :class="{'highlight-lm': cursor == moveIdx+1}" @click="() => gotoMove(moveIdx+1)" ) - | {{ notation(moves[moveIdx + 1]) }} + | {{ notation(moveIdx + 1) }}