Skip to content

Commit ae68b7e

Browse files
committed
Minefield: Another board size tweak
1 parent db70f3e commit ae68b7e

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

locales/en/apgames.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,8 +1683,8 @@
16831683
}
16841684
},
16851685
"minefield": {
1686-
"size-7": {
1687-
"name": "7x7 board"
1686+
"size-8": {
1687+
"name": "8x8 board"
16881688
},
16891689
"size-9": {
16901690
"name": "9x9 board"

src/common/plotting.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,16 @@ export function allRotationsAndReflections(
250250
const includeReflections = options?.includeReflections ?? true;
251251
const normalize = options?.normalize ?? "none";
252252

253+
// Check for duplicate points
254+
const seenPoints = new Set<string>();
255+
for (const { dx, dy } of deltas) {
256+
const key = `${dx},${dy}`;
257+
if (seenPoints.has(key)) {
258+
throw new Error(`Input contains duplicate points: ${key}`);
259+
}
260+
seenPoints.add(key);
261+
}
262+
253263
// ---- D4 transforms on the (dx,dy) portion only; pc is retained
254264
const rot90 = (d: Delta): Delta => ({ dx: -d.dy, dy: d.dx, payload: d.payload });
255265
const rot180 = (d: Delta): Delta => ({ dx: -d.dx, dy: -d.dy, payload: d.payload });
@@ -279,7 +289,7 @@ export function allRotationsAndReflections(
279289
};
280290

281291
// ---- Stable key for dedupe (includes pc to avoid collapsing different labeled shapes)
282-
// Sort by dx, dy, pc so that order in input doesn't matter.
292+
// Sort by dx, dy so that order in input doesn't matter.
283293
const keyOf = (ds: Delta[]): string => {
284294
const sorted = [...ds].sort((a, b) =>
285295
(a.dx - b.dx) || (a.dy - b.dy)

src/games/minefield.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class MinefieldGame extends GameBase {
5353
},
5454
],
5555
variants: [
56-
{ uid: "size-7", group: "board" },
56+
{ uid: "size-8", group: "board" },
5757
{ uid: "size-9", group: "board" },
5858
{ uid: "#board", },
5959
{ uid: "size-13", group: "board" },

0 commit comments

Comments
 (0)