Skip to content

Commit b90d74f

Browse files
committed
Stawvs: Add experimental flag
1 parent f858a8f commit b90d74f

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/games/stawvs.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class StawvsGame extends GameBase {
8787
{uid: "pieces-2"}
8888
],
8989
categories: ["goal>score>eog", "mechanic>set", "board>shape>rect", "board>connect>rect", "components>pyramids", "other>2+players"],
90-
flags: ["scores", "autopass"]
90+
flags: ["scores", "autopass", "experimental"]
9191
};
9292

9393
public static coords2algebraic(x: number, y: number): string {
@@ -126,13 +126,13 @@ export class StawvsGame extends GameBase {
126126
emptyCells = this.getFourRandomCells();
127127

128128
this.pieceCount = this.getPieceCount();
129-
129+
130130
const board = new Map<string, CellContents>([]);
131131
const bag: Pyramid[] = [];
132132
for (let stash = 0; stash < triosPerColor; stash++) {
133133
for (let size = 1; size < numberOfColors; size++) {
134134
for (let c = 0; c < allColours.length; c++) {
135-
bag.push([allColours[c], size] as Pyramid);
135+
bag.push([allColours[c], size] as Pyramid);
136136
}
137137
}
138138
}
@@ -146,8 +146,8 @@ export class StawvsGame extends GameBase {
146146
}
147147
}
148148

149-
const captured = Array(this.numplayers).fill([]);
150-
149+
const captured = Array(this.numplayers).fill([]);
150+
151151
const fresh: IMoveState = {
152152
_version: StawvsGame.gameinfo.version,
153153
_results: [],
@@ -223,7 +223,7 @@ export class StawvsGame extends GameBase {
223223
//Can't fish yourself.
224224
if (cellA === cellB)
225225
return false;
226-
226+
227227
//Test cellB for existence and availability.
228228
if (! this.isAvailable(cellB))
229229
return false;
@@ -244,7 +244,7 @@ export class StawvsGame extends GameBase {
244244
if (! this.isAvailable(testCell) && ((! cellMe) || (testCell !== cellMe)))
245245
return false;
246246
}
247-
247+
248248
//Passed all our tests.
249249
return true;
250250
}
@@ -377,7 +377,7 @@ export class StawvsGame extends GameBase {
377377
//Generate the list of moves, for pass validation and autopass.
378378
//If this is too inefficient, generating only the moves for the "hey" variant,
379379
// would still suffice for pass testing in all cases.
380-
380+
381381
if (this.gameover) {
382382
return [];
383383
}
@@ -390,7 +390,7 @@ export class StawvsGame extends GameBase {
390390
if (this.mode === "collect" && this.eliminated.indexOf(this.currplayer) > -1) {
391391
return ["pass"];
392392
}
393-
393+
394394
if (this.mode === "place") {
395395
// If the player is placing pieces, enumerate the available cells.
396396
for (let row = 0; row < boardDim; row++) {
@@ -441,7 +441,7 @@ export class StawvsGame extends GameBase {
441441
try {
442442
let newmove = "";
443443
const cell = StawvsGame.coords2algebraic(col, row);
444-
444+
445445
if (this.mode === "place" || move === "")
446446
newmove = cell;
447447
else if (move.indexOf(",") > -1) {
@@ -541,7 +541,7 @@ export class StawvsGame extends GameBase {
541541
return result;
542542
}
543543

544-
if (cells.length === 1) {
544+
if (cells.length === 1) {
545545
result.valid = true;
546546
result.complete = -1;
547547
result.canrender = true;
@@ -550,14 +550,14 @@ export class StawvsGame extends GameBase {
550550
}
551551

552552
const [cell1,cell2] = cells[1].split(",");
553-
553+
554554
if (! this.canFish(cell0,cell1) ) {
555555
result.valid = false;
556556
result.message = i18next.t("apgames:validation.stawvs.BAD_MOVE");
557557
return result;
558558
}
559559

560-
if (! cell2) {
560+
if (! cell2) {
561561
result.valid = true;
562562
result.complete = -1;
563563
result.canrender = true;
@@ -580,7 +580,7 @@ export class StawvsGame extends GameBase {
580580
return result;
581581
}
582582
}
583-
583+
584584
if (cell2 !== cell0 && (! this.canFish(cell1,cell2,cell0)) ) {
585585
result.valid = false;
586586
result.message = i18next.t("apgames:validation.stawvs.BAD_CLAIM");
@@ -614,7 +614,7 @@ export class StawvsGame extends GameBase {
614614
this.eliminated.push(this.currplayer);
615615
if (this.eliminated.length < this.numplayers)
616616
this.results = [{type: "eliminated", who: this.currplayer.toString()}];
617-
else
617+
else
618618
this.results = [{type: "pass"}];
619619
} else {
620620
this.results = [{type: "pass"}];
@@ -653,7 +653,7 @@ export class StawvsGame extends GameBase {
653653
if (this.mode === "place" && this.checkPlaced()) {
654654
this.mode = "collect";
655655
}
656-
656+
657657
// update currplayer
658658
this.lastmove = m;
659659
let newplayer = (this.currplayer as number) + 1;
@@ -688,7 +688,7 @@ export class StawvsGame extends GameBase {
688688
}
689689
}
690690
}
691-
691+
692692
const scores = this.getPlayersScores()[0].scores as number[];
693693
const max = Math.max(...scores);
694694
for (let p = 1; p <= this.numplayers; p++) {
@@ -697,7 +697,7 @@ export class StawvsGame extends GameBase {
697697
}
698698
}
699699
}
700-
700+
701701
if (this.gameover) {
702702
this.results.push(
703703
{type: "eog"},
@@ -750,7 +750,7 @@ export class StawvsGame extends GameBase {
750750
const lgs = pile.filter(x => x[1] === 3);
751751
const mds = pile.filter(x => x[1] === 2);
752752
const sms = pile.filter(x => x[1] === 1);
753-
753+
754754
// Put each large in a stack and then look for a matching medium and small
755755
// This will find all monochrome trios
756756
while (lgs.length > 0) {
@@ -832,7 +832,7 @@ export class StawvsGame extends GameBase {
832832
org.miscellaneous.push(...clone(stack) as Pyramid[]);
833833
}
834834
}
835-
835+
836836
return org;
837837
}
838838

@@ -892,7 +892,7 @@ export class StawvsGame extends GameBase {
892892
pstr.push(pieces);
893893
}
894894

895-
// build legend
895+
// build legend
896896
const myLegend: ILegendObj = {};
897897
for (let c = 0; c < allColours.length; c++) {
898898
// Use lighter colors from the end of the palette.
@@ -971,7 +971,7 @@ export class StawvsGame extends GameBase {
971971
};
972972

973973
// eslint-disable-next-line @typescript-eslint/no-explicit-any
974-
const areas: any[] = [];
974+
const areas: any[] = [];
975975

976976
// Add captured pyramids
977977
for (let p = 1; p <= this.numplayers; p++) {
@@ -982,15 +982,15 @@ export class StawvsGame extends GameBase {
982982
label: i18next.t("apgames:validation.stawvs.LABEL_COLLECTION", {playerNum: p}) || `P${p}'s pyramids`,
983983
stash: []
984984
};
985-
985+
986986
const org = this.organizeCaps((p) as playerid);
987987
node.stash.push(...org.triosMono.map((s) => this.renderStashHelper(s)));
988988
node.stash.push(...org.triosMixed.map((s) => this.renderStashHelper(s)));
989989
node.stash.push(...org.partialsMono.map((s) => this.renderStashHelper(s)));
990990
node.stash.push(...org.partialsMixed.map((s) => this.renderStashHelper(s)));
991991
node.stash.push(...org.miscellaneous.map((s) => this.renderStashHelper([s])));
992992
areas.push(node);
993-
993+
994994
}
995995
}
996996

@@ -1047,7 +1047,7 @@ export class StawvsGame extends GameBase {
10471047
};
10481048
for (let n = 3; n <= this.numplayers; n++) {
10491049
iscoreObj.scores.push(this.getPlayerScore(n));
1050-
}
1050+
}
10511051
return [iscoreObj];
10521052
}
10531053

0 commit comments

Comments
 (0)