Skip to content

Commit c717349

Browse files
committed
Jacynth: Get rid of double annotations and fix the claim annotation to have more space in the enter notation
1 parent 7450cca commit c717349

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/games/jacynth.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export class JacynthGame extends GameBase {
182182
}
183183

184184
const state = this.stack[idx];
185+
this.results = [...state._results];
185186
this.currplayer = state.currplayer;
186187
this.board = new Map(state.board);
187188
this.claimed = new Map(state.claimed);
@@ -714,12 +715,19 @@ export class JacynthGame extends GameBase {
714715
};
715716

716717
// Add annotations
717-
if (this.stack[this.stack.length - 1]._results.length > 0) {
718+
if (this.results.length > 0) {
718719
rep.annotations = [];
719-
for (const move of this.stack[this.stack.length - 1]._results) {
720-
if (move.type === "place" || move.type === "claim") {
720+
for (const move of this.results) {
721+
if (move.type === "place") {
722+
// only add if there's not a claim for the same cell
723+
const found = this.results.find(r => r.type === "claim" && r.where === move.where);
724+
if (found === undefined) {
725+
const [x, y] = JacynthGame.algebraic2coords(move.where!);
726+
rep.annotations.push({type: "enter", occlude: false, targets: [{row: y, col: x}]});
727+
}
728+
} else if (move.type === "claim") {
721729
const [x, y] = JacynthGame.algebraic2coords(move.where!);
722-
rep.annotations.push({type: "enter", occlude: false, targets: [{row: y, col: x}]});
730+
rep.annotations.push({type: "enter", occlude: false, dashed: [4,8], targets: [{row: y, col: x}]});
723731
}
724732
}
725733
}

0 commit comments

Comments
 (0)