X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FHex%2Fclass.js;fp=variants%2FHex%2Fclass.js;h=f1e3a8388f25860c31215ba49e1a5fc55bed6a4c;hb=728cb1e3b2ae84b1cf4aaa7e66b295f77dea359e;hp=0000000000000000000000000000000000000000;hpb=9543a40b85791394f3ac46654b45f272a13b582b;p=xogo.git diff --git a/variants/Hex/class.js b/variants/Hex/class.js new file mode 100644 index 0000000..f1e3a83 --- /dev/null +++ b/variants/Hex/class.js @@ -0,0 +1,36 @@ + getSvgChessboard() { + const flipped = (this.playerColor == 'b'); + let board = ` + + + + + + `; + for (let i=0; i < this.size.x; i++) { + for (let j=0; j < this.size.y; j++) { + let classes = this.getSquareColorClass(i, j); + board += ``; + } + } + board += ""; + return board; + } + +// neutral-light neutral-dark --> specify per variant in CSS file + getSquareColorClass(i, j) { + return ((i+j) % 2 == 0 ? "light-square": "dark-square"); + } + +// TODO: generalize base_rules.js to not assume size.x == width and size.y == height (not true here).