Skip to content

Commit 190f409

Browse files
committed
Penguin: Another 'complete' bug
1 parent 3a57650 commit 190f409

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/games/penguin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ export class PenguinGame extends GameBase {
346346
throw new Error("Unable to parse move");
347347
}
348348
m = parsed.normalized;
349+
console.log(`parsed: ${JSON.stringify(parsed)}`)
349350

350351
if (m.length === 0) {
351352
result.valid = true;
@@ -361,7 +362,7 @@ export class PenguinGame extends GameBase {
361362
// if no turns were provided, and the piece is not standing
362363
// then not yet complete
363364
let complete: 0 | 1 | -1 | undefined = 1;
364-
if ((parsed.turnDir === undefined || parsed.turnNum === undefined) && this.ball !== parsed.cell) {
365+
if ((parsed.turnDir === undefined || parsed.turnNum === undefined) && (parsed.cell === undefined || this.ball !== parsed.cell)) {
365366
const cloned = this.clone();
366367
const exe = cloned.executeMove(m);
367368
if (cloned.board.has(exe.endCell!)) {

0 commit comments

Comments
 (0)