Skip to content

Commit d7a2d48

Browse files
committed
Emu: Fix eoy situation where the last player is also the start player for the next year
1 parent c2b8451 commit d7a2d48

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/games/emu.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,10 @@ export class EmuGame extends GameBase {
967967
this.results = [{type: "pass"}];
968968
this.lastmove = "pass"
969969
} else {
970-
this.results = [];
970+
console.log("Already the correct player")
971+
// actually, don't clear the results
972+
// this will clobber the scoring
973+
// this.results = [];
971974
}
972975
this.currplayer = nextp;
973976
// reset the game
@@ -1329,7 +1332,11 @@ export class EmuGame extends GameBase {
13291332
piece = pieces.find(p => p.glyph === "c" + move.how)
13301333
}
13311334
if (piece === undefined) {
1332-
throw new Error(`Could not find the card to annotate (where: ${move.where}, how: ${move.how}).\n${JSON.stringify(pieces)}`);
1335+
// don't throw an error
1336+
// this can happen when ending a year and there's no intervening pass
1337+
// so just continue
1338+
continue;
1339+
// throw new Error(`Could not find the card to annotate (where: ${move.where}, how: ${move.how}).\n${JSON.stringify(pieces)}`);
13331340
}
13341341
const xStart = piece.x - halfUnit;
13351342
const yStart = piece.y - halfUnit;

0 commit comments

Comments
 (0)