Skip to content

Commit a80733c

Browse files
committed
Logger: Fix edge-of-board issue cutting down lines of trees
1 parent d1b9c38 commit a80733c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/games/logger.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,10 @@ export class LoggerGame extends GameBase {
712712
const [tx,ty] = graph.algebraic2coords(cell);
713713
const bearing = RectGrid.bearing(lx, ly, tx, ty)!;
714714
const ray = grid.ray(tx, ty, bearing).map(coord => graph.coords2algebraic(...coord));
715-
const stop = ray.findIndex(c => !this.board.has(c) || (this.board.get(c) !== "L") && (this.board.get(c) !== "X") );
715+
let stop = ray.findIndex(c => !this.board.has(c) || (this.board.get(c) !== "L") && (this.board.get(c) !== "X") );
716+
if (stop === -1) {
717+
stop = ray.length;
718+
}
716719
const dominos = ray.slice(0, stop);
717720
let pts = 0;
718721
for (const chop of [cell, ...dominos]) {

0 commit comments

Comments
 (0)