From 3e50885f482e39016fe9acda689615a7ca32e205 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 21 Sep 2026 15:15:08 +0000 Subject: [PATCH] Mark Lielow's moves-until-suicide score as a spoiler Flag the "Moves until suicide" row returned by sidebarScores() with spoiler: true so the front end withholds it until the game is over for players who have the "hide spoilers" setting turned on. "Pieces remaining" stays visible, since it is readable straight off the board. Adds a focused test asserting which sidebar rows carry the flag. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_018ohjcoe7GBxKmZYbFbddVy --- src/games/lielow.ts | 2 +- test/games/lielow.test.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/games/lielow.test.ts diff --git a/src/games/lielow.ts b/src/games/lielow.ts index 76a780a1..8e6e2d3a 100644 --- a/src/games/lielow.ts +++ b/src/games/lielow.ts @@ -890,7 +890,7 @@ export class LielowGame extends GameBase { const suicideMoves = this.movesUntilSuicide(); return [ { name: this.neutralAreaLabel("apgames:status.PIECESREMAINING"), scores: [this.getPlayerPieces(1), this.getPlayerPieces(2)] }, - { name: this.neutralAreaLabel("apgames:status.lielow.MOVESUNTILSUICIDE"), scores: [suicideMoves[0], suicideMoves[1]] } + { name: this.neutralAreaLabel("apgames:status.lielow.MOVESUNTILSUICIDE"), scores: [suicideMoves[0], suicideMoves[1]], spoiler: true } ] } diff --git a/test/games/lielow.test.ts b/test/games/lielow.test.ts new file mode 100644 index 00000000..4a5cabde --- /dev/null +++ b/test/games/lielow.test.ts @@ -0,0 +1,27 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions */ +import "mocha"; +import { expect } from "chai"; +import { LielowGame } from "../../src/games/lielow"; +import { isStructuredRenderLabel } from "../../src/common/render-label"; + +function textKey(label: unknown): string | undefined { + return isStructuredRenderLabel(label) ? label.textKey : undefined; +} + +describe("Lielow", () => { + describe("sidebarScores", () => { + it("marks moves until suicide as a spoiler but leaves pieces remaining visible", () => { + const g = new LielowGame(); + const scores = g.sidebarScores(); + expect(scores).to.have.lengthOf(2); + + const pieces = scores.find((s) => textKey(s.name) === "apgames:status.PIECESREMAINING"); + expect(pieces).to.not.be.undefined; + expect(pieces!.spoiler).to.not.equal(true); + + const suicide = scores.find((s) => textKey(s.name) === "apgames:status.lielow.MOVESUNTILSUICIDE"); + expect(suicide).to.not.be.undefined; + expect(suicide!.spoiler).to.be.true; + }); + }); +});