Skip to content

Commit 2913554

Browse files
committed
Jacynth: Add adjacency rule
1 parent bf0fbc8 commit 2913554

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

locales/en/apgames.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3471,6 +3471,7 @@
34713471
"LABEL_STASH": "Player {{playerNum}}'s hand",
34723472
"NO_CARD": "The card \"{{card}}\" does not appear to be in your hand.",
34733473
"NO_INFLUENCE": "You don't have any influence left.",
3474+
"NOT_ADJ": "New cards must be placed adjacent to at least one existing card.",
34743475
"PARTIAL_PLACEMENT": "Click an empty space on the board to place your card."
34753476
},
34763477
"konane": {

src/games/jacynth.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,19 @@ export class JacynthGame extends GameBase {
419419
result.message = i18next.t("apgames:validation._general.OCCUPIED", {cell: to});
420420
return result;
421421
}
422+
// adjacent to existing card
423+
let hasadj = false;
424+
for (const n of g.neighbours(to)) {
425+
if (this.board.has(n)) {
426+
hasadj = true;
427+
break;
428+
}
429+
}
430+
if (!hasadj) {
431+
result.valid = false;
432+
result.message = i18next.t("apgames:validation.jacynth.NOT_ADJ");
433+
return result;
434+
}
422435

423436
// if influence is missing, may or not be complete
424437
if (influence === undefined || influence.length === 0) {

0 commit comments

Comments
 (0)