Skip to content

Commit 970551c

Browse files
committed
Minefield: Update pinwheel rules link and add passedOut failsafe
1 parent f7f061f commit 970551c

1 file changed

Lines changed: 26 additions & 15 deletions

File tree

src/games/minefield.ts

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class MinefieldGame extends GameBase {
4040
urls: [
4141
"https://www.marksteeregames.com/Minefield_rules.pdf",
4242
"https://boardgamegeek.com/thread/3295906/new-mark-steere-game-minefield",
43-
"https://boardgamegeek.com/thread/3299199/cartwheel-possibly-free-of-mutual-zugzwang",
43+
"https://boardgamegeek.com/thread/3296675/pinwheel-minimal-restrictions",
4444
],
4545
people: [
4646
{
@@ -494,25 +494,36 @@ export class MinefieldGame extends GameBase {
494494
protected checkEOG(): MinefieldGame {
495495
const prevPlayer = this.currplayer === 1 ? 2 : 1;
496496

497-
const graph = this.buildGraph(prevPlayer);
498-
const [sources, targets] = this.lines[prevPlayer - 1];
499-
for (const source of sources) {
500-
for (const target of targets) {
501-
if ( (graph.hasNode(source)) && (graph.hasNode(target)) ) {
502-
const path = bidirectional(graph, source, target);
503-
if (path !== null) {
504-
this.gameover = true;
505-
this.winner = [prevPlayer];
506-
this.connPath = [...path];
507-
break;
497+
let passedOut = false;
498+
if ( (this.lastmove === "pass") && (this.stack[this.stack.length - 1].lastmove === "pass") ) {
499+
passedOut = true;
500+
}
501+
502+
if (passedOut) {
503+
this.gameover = true;
504+
this.winner = [1,2];
505+
} else {
506+
const graph = this.buildGraph(prevPlayer);
507+
const [sources, targets] = this.lines[prevPlayer - 1];
508+
for (const source of sources) {
509+
for (const target of targets) {
510+
if ( (graph.hasNode(source)) && (graph.hasNode(target)) ) {
511+
const path = bidirectional(graph, source, target);
512+
if (path !== null) {
513+
this.gameover = true;
514+
this.winner = [prevPlayer];
515+
this.connPath = [...path];
516+
break;
517+
}
508518
}
509519
}
510-
}
511-
if (this.gameover) {
512-
break;
520+
if (this.gameover) {
521+
break;
522+
}
513523
}
514524
}
515525

526+
516527
if (this.gameover) {
517528
this.results.push(
518529
{type: "eog"},

0 commit comments

Comments
 (0)