diff --git a/locales/en/apgames.json b/locales/en/apgames.json index 32ee7ca4..b6232538 100644 --- a/locales/en/apgames.json +++ b/locales/en/apgames.json @@ -4561,9 +4561,9 @@ "PARTIAL": "Select one of the highlighted cells to move the glider. If a bar has appeared at the edge of the board, you can click it to move the glider off the board." }, "go": { - "INITIAL_SETUP": "Choose a number of points to add to the second player's score, and the next player will choose sides (0.5 will be added to prevent draws). This implementation uses Chinese area rules. Scores are based on the current area ownership. Players do need to capture all dead stones before ending the game with two consecutive passes.", + "INITIAL_SETUP": "Choose a number of points to add to the second player's score, and the next player will choose sides. This implementation uses Chinese area rules. Scores are based on the current area ownership. Players do need to capture all dead stones before ending the game with two consecutive passes.", "INSTRUCTIONS": "Select an intersection to place a piece.", - "INVALID_KOMI": "You must choose an integer number of points to add to the second player's score.", + "INVALID_KOMI": "You must choose an number in increments of 0.5 (like 4 or 4.5) to add to the second player's score.", "INVALID_PIE": "You cannot accept or reject a pie offer now.", "INVALID_PLAYSECOND": "You cannot choose to play second from this board state.", "KOMI_CHOICE": "You may either make the first move on the board and let your opponent keep the bonus points (an integer) or you may choose \"Play second\" and take the bonus points for yourself.", diff --git a/src/games/go.ts b/src/games/go.ts index 7eea1253..696da7ca 100644 --- a/src/games/go.ts +++ b/src/games/go.ts @@ -281,8 +281,9 @@ export class GoGame extends GameBase { return result; } - // player typed something in the move textbox, check if it is an integer - if (! /^-?\d+$/.test(m)) { + // player typed something in the move textbox, + // check if it is an integer or a number with 0.5 decimal part + if (! /^-?\d+(\.[05])?$/.test(m)) { result.valid = false; result.message = i18next.t("apgames:validation.go.INVALID_KOMI"); return result @@ -359,6 +360,7 @@ export class GoGame extends GameBase { result.valid = true; result.complete = 1; result.message = i18next.t("apgames:validation._general.VALID_MOVE"); + result.canrender = true; return result; } @@ -505,7 +507,7 @@ export class GoGame extends GameBase { } if (m.length === 0) { return this; } this.results = []; - + if (this.isKomiTurn()) { // first move, get the Komi proposed value, and add komi to game state this.komi = parseInt(m, 10); @@ -570,7 +572,7 @@ export class GoGame extends GameBase { if (this.gameover) { this.scores = [this.getPlayerScore(1), this.getPlayerScore(2)]; // draws by score are impossible - this.winner = this.scores[0] > this.scores[1] ? [1] : [2]; + this.winner = this.scores[0] > this.scores[1] ? [1] : [2]; this.results.push( {type: "eog"}, {type: "winners", players: [...this.winner]} @@ -687,9 +689,9 @@ export class GoGame extends GameBase { .map(pair => pair[0]); let komi = 0.0; if (player === 1 && this.komi !== undefined && this.komi < 0) - komi = -this.komi + 0.5; // 0.5 is to prevent draws + komi = -this.komi; if (player === 2 && this.komi !== undefined && this.komi > 0) - komi = this.komi + 0.5; + komi = this.komi; const terr = this.getTerritories(); return terr.filter(t => t.owner === player).reduce((prev, curr) => prev + curr.cells.length, komi + playerPieces.length); diff --git a/src/games/product.ts b/src/games/product.ts index 4a5aba73..10fcaeea 100644 --- a/src/games/product.ts +++ b/src/games/product.ts @@ -214,7 +214,7 @@ export class ProductGame extends GameBase { } } - return moves; + return moves.sort((a,b) => a.localeCompare(b)); } public randomMove(): string { diff --git a/src/games/stiletto.ts b/src/games/stiletto.ts index 209339dc..c605ef11 100644 --- a/src/games/stiletto.ts +++ b/src/games/stiletto.ts @@ -225,7 +225,7 @@ export class StilettoGame extends InARowBase { for (let col = 0; col < this.boardSize; col++) { const cell = this.coords2algebraic(col, row); if (this.board.has(cell)) { continue; } - moves.push(this.normaliseMove(cell)); + moves.push(this.normaliseMove(cell)); } } @@ -269,7 +269,7 @@ export class StilettoGame extends InARowBase { } */ - return moves; + return moves.sort((a,b) => a.localeCompare(b)); } public randomMove(): string { @@ -429,6 +429,7 @@ export class StilettoGame extends InARowBase { result.valid = true; result.message = i18next.t("apgames:validation._general.VALID_MOVE"); + result.canrender = true; return result; }