Skip to content

Commit 1b2d698

Browse files
committed
Enso: Move bug
1 parent 14b8479 commit 1b2d698

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/games/enso.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,18 @@ export class EnsoGame extends GameBase {
162162
for (const dir of allDirections) {
163163
let ray = g.ray(fx, fy, dir).map(c => g.coords2algebraic(...c));
164164
const idx = ray.findIndex(cell => this.board.has(cell));
165-
if (idx >= 0) {
165+
if (idx > 0) {
166166
// this ray only contains contiguous empty spaces leading up
167167
// to the first occupied space
168168
ray = ray.slice(0, idx);
169-
for (const next of ray) {
170-
const cloned = this.clone();
171-
cloned.board.delete(pc);
172-
cloned.board.set(next, player);
173-
const status = cloned.connStatus(next);
174-
if (status === "isolated" || status === "enemy") {
175-
moves.push(`${pc}-${next}`);
176-
}
169+
}
170+
for (const next of ray) {
171+
const cloned = this.clone();
172+
cloned.board.delete(pc);
173+
cloned.board.set(next, player);
174+
const status = cloned.connStatus(next);
175+
if (status === "isolated" || status === "enemy") {
176+
moves.push(`${pc}-${next}`);
177177
}
178178
}
179179
}

0 commit comments

Comments
 (0)