From: Benjamin Auder Date: Thu, 7 Jul 2022 21:28:56 +0000 (+0200) Subject: Bario: final fix X-Git-Url: https://git.auder.net/img/vendor/pieces/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=2fdfb05d9ff644c1b57823e7988461853cccb3d4;p=xogo.git Bario: final fix --- diff --git a/variants/Atarigo/rules.html b/variants/Atarigo/rules.html index c65158e..62f712f 100644 --- a/variants/Atarigo/rules.html +++ b/variants/Atarigo/rules.html @@ -1 +1,13 @@ -

TODO

+

+ Simplified version of the Go game: + the first player to capture something wins. +

+ +

+ Capture stones by surrounding them. + + Wikipedia page. + +

+ +

Yasutoshi Yasuda (2003).

diff --git a/variants/Bario/class.js b/variants/Bario/class.js index 871a537..603aded 100644 --- a/variants/Bario/class.js +++ b/variants/Bario/class.js @@ -113,6 +113,8 @@ export default class BarioRules extends ChessRules { case 0: if (typeof x == "string") moves = this.getDropMovesFrom([x, y]); + // Empty move: just start + end + moves.forEach(m => {m.vanish.pop(); m.appear.pop();}); break; case 1: // Both normal move (from defined piece) and definition allowed @@ -201,7 +203,8 @@ export default class BarioRules extends ChessRules { postPlay(move) { const color = this.turn; if (this.movesCount <= 1 || move.reset || move.next) { - this.tryChangeTurn(); + if (!move.next) + this.tryChangeTurn(); return; } if (this.subTurn == 0) @@ -216,7 +219,7 @@ export default class BarioRules extends ChessRules { super.postPlay(move); else if (typeof move.start.x == "string") { super.updateReserve( - color, move.appear[0].p, this.reserve[color][move.appear[0].p] - 1); + color, move.start.y, this.reserve[color][move.start.y] - 1); if (move.vanish.length == 1 && move.vanish[0].p == 'u') this.definition = move.end; this.subTurn++; @@ -224,17 +227,16 @@ export default class BarioRules extends ChessRules { else { this.subTurn = 0; this.captureUndef = move.end; - this.tryChangeTurn(move, captureUndef); + this.tryChangeTurn(null, captureUndef); } } + // NOTE: not "trying", the turn always change here (TODO?) tryChangeTurn(move, captureUndef) { - if (!move.next) { - this.definition = null; - this.subTurn = captureUndef ? 0 : 1; - this.turn = C.GetOppCol(this.turn); - this.movesCount++; - } + this.definition = null; + this.subTurn = captureUndef ? 0 : 1; + this.turn = C.GetOppCol(this.turn); + this.movesCount++; } computeNextMove(move) { diff --git a/variants/Bario/rules.html b/variants/Bario/rules.html index c65158e..f5fd782 100644 --- a/variants/Bario/rules.html +++ b/variants/Bario/rules.html @@ -1 +1,21 @@ -

TODO

+

+ Pieces start in an undefined (and unusable) state, + pictured by a question mark. + At first move, click on a square for the king. +

+ +

+ Define a piece by dragging a reserve piece onto a question mark, + and then move it on the board. +

+ +

+ Once all pieces of some color have been defined, + all pieces on board return to undefined state. +

+ + + Complete rules description. + + +

Panos Louridas (1985).