Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion locales/en/apgames.json
Original file line number Diff line number Diff line change
Expand Up @@ -6604,7 +6604,7 @@
"NO_EXPAND_Y": "You may not expand the board beyond a height of {{size}}."
},
"tricouleur": {
"INITIAL_INSTRUCTIONS": "Select a piece to duplicate or jump. Rocks are represented as cogs, Paper as squares, and Scissors as Xs.",
"INITIAL_INSTRUCTIONS": "Select a piece to duplicate or jump. Rocks are represented as circles, Paper as squares, and Scissors as Xs.",
"INITIAL_INSTRUCTIONS_PASS": "You have no moves so you must pass.",
"INVALID_TO": "The piece at {{from}} cannot duplicate or jump to {{to}}.",
"MUST_PASS": "The only move available to you is to pass.",
Expand Down
12 changes: 12 additions & 0 deletions locales/en/apresults.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@
"spook_lateral_opponent_other": "{{player}} has {{count}} of their opponent's balls captured by Spooky on the same level at {{where}}.",
"spook_lateral_self_one": "{{player}} has 1 of their own ball captured by Spooky on the same level at {{where}}.",
"spook_lateral_self_other": "{{player}} has {{count}} of their own balls captured by Spooky on the same level at {{where}}.",
"spora" : "{{player}} surrounded and captured {{count}} piece(s): {{group}}.",
"stawvs": "{{player}} captured the {{what}} at {{where}}.",
"tafl": "{{player}} captured a piece at {{where}}.",
"terrace_other": "{{player}} captured a size {{what}} piece at {{where}}.",
"terrace_self": "{{player}} cannibalized their own size {{what}} piece at {{where}}.",
"tricouleur": "{{count}} pieces changed colour.",
"tumbleweed": "{{player}} captured a stack of size {{count}} at {{where}}.",
"tumbleweed_self": "{{player}} reinforces a stack of size {{count}} at {{where}}.",
"witch": {
Expand Down Expand Up @@ -341,14 +343,18 @@
"phutball_last": "{{player}} moved the ball from {{from}} to {{to}}.",
"phutball_to": "to {{to}},",
"phutball_to_last": "to {{to}}.",
"posit": "{{player}} moved his piece from {{from}} to {{to}}.",
"push": "A {{what}} was pushed from {{from}} to {{to}}.",
"saltire": "{{player}} swapped the pieces at {{from}} and {{to}}.",
"slyde": "{{player}} slid a piece from {{from}} to {{to}}.",
"spook": "{{player}} moved Spooky from {{from}} to {{to}}.",
"spora": "{{player}} sowed from {{from}} to {{to}}.",
"stawvs": "{{player}} moved a piece from {{from}} to {{to}} and captured {{what}} at {{how}}.",
"susan": "{{player}} slid a piece from {{from}} to {{to}}.",
"tafl": "{{player}} moved a piece from {{from}} to {{to}}.",
"tafl_jump": "{{player}} jumped a piece from {{from}} to {{to}}.",
"tricouleur_jump": "{{player}} jumped a piece from {{from}} to {{to}}.",
"tricouleur_duplicate": "{{player}} duplicated a piece from {{from}} to {{to}}.",
"veletas": "{{player}} moved shooter from {{from}} to {{to}}.",
"volo_one": "{{player}} moved a flock of 1 bird from {{from}} in the direction {{how}}.",
"volo_other": "{{player}} moved a flock of {{count}} birds from {{from}} in the direction {{how}}."
Expand All @@ -367,6 +373,7 @@
"frogger": "{{player}} passed {{why}}.",
"pie": "{{player}} accepted the komi offer and will continue playing second.",
"pigs": "{{player}} idles.",
"pippinzip": "{{player}} decides to pass and becomes Zip",
"simple": "{{player}} passed.",
"tablero": "{{player}} bumped!",
"tiebreaker": "{{player}} passed, winning the tiebreaker."
Expand Down Expand Up @@ -397,6 +404,7 @@
"ccorridor": "{{player}} placed a tile at {{where}}.",
"chase": "The chamber spit out a {{what}} at {{where}}.",
"complete": "{{player}} placed a {{what}} at {{where}}.",
"court": "{{player}} promoted {{where}} to a {{what}}.",
"crosshairs_plane": "{{player}} entered a plane at {{where}}.",
"crosshairs_cloud": "{{player}} placed a cloud at {{where}}.",
"conhex": "{{player}} placed a piece at vertex {{where}}.",
Expand Down Expand Up @@ -436,6 +444,7 @@
"pahtum_block": "{{player}} blocked off {{where}}.",
"pahtum_piece": "{{player}} placed a piece at {{where}}.",
"phutball": "{{player}} placed a player at {{where}}.",
"pollux": "{{player}} blocks {{where}}.",
"PYRAMID_1": "{{player}} placed a small piece at {{where}}.",
"PYRAMID_2": "{{player}} placed a medium piece at {{where}}.",
"PYRAMID_3": "{{player}} placed a large piece at {{where}}.",
Expand All @@ -448,6 +457,7 @@
"spire_neutral": "{{player}} placed a neutral ball at {{where}}.",
"spire_player": "{{player}} placed a ball of their colour at {{where}}.",
"spooky": "Spooky has entered the board at {{where}}.",
"spora": "{{player}} added {{size}} piece(s) to stack at {{where}}.",
"stawvs": "{{player}} placed a piece at {{where}}.",
"strands_initial": "{{player}} placed a piece on a space labelled 2 at {{where}}.",
"strands_one": "{{player}} placed a piece at {{where}}.",
Expand All @@ -466,6 +476,7 @@
"streetcar_42": "A height-2 WHITE building was placed at {{where}}.",
"streetcar_43": "A height-3 WHITE building was placed at {{where}}.",
"subdivision_park": "{{player}} placed a park at {{where}}.",
"synapse" : "{{player}} place at {{where}} a size {{size}} piece directed at {{dir}}.",
"terrace": "{{player}} moved a size {{size}} piece from {{from}} to {{to}}.",
"theirs": "{{player}} placed an enemy piece at {{where}}.",
"theirs_specific": "{{player}} placed a {{enemy}} piece at {{where}}.",
Expand All @@ -476,6 +487,7 @@
"tritium-flag": "{{player}} played a flag at {{where}}.",
"tumbleweed": "{{player}} placed a stack of size {{count}} at {{where}}.",
"twixt": "{{player}} placed a peg at {{where}}.",
"unane": "{{player}} self-captured {{where}}.",
"upperhand_chain": "A ball of {{whose}} was placed at {{where}}.",
"urbino": {
"house": "{{player}} placed a house at {{where}}.",
Expand Down
22 changes: 21 additions & 1 deletion src/games/court.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ export class CourtGame extends GameBase {
const idxPiece = this.hands[this.currplayer - 1].indexOf(moves[1] as Piece);
this.hands[this.currplayer - 1].splice(idxPiece, 1); // remove piece from player's hand
this.board.set(moves[0], [moves[1] as Piece, this.currplayer]); // add piece to board
this.results.push({ type: "place", where: moves[0] });
const what = moves[1] === "N" ? "Knight" : (moves[1] === "B" ? "Bishop" : "Rook");
this.results.push({ type: "place", where: moves[0], what: what });
} else { // it is a move
this.board.set(moves[1], this.board.get(moves[0])!);
this.board.delete(moves[0]);
Expand Down Expand Up @@ -488,6 +489,25 @@ export class CourtGame extends GameBase {
];
}

public chat(node: string[], player: string, results: APMoveResult[], r: APMoveResult): boolean {
let resolved = false;
switch (r.type) {
case "place":
node.push(i18next.t("apresults:PLACE.court", { player, where: r.where, what: r.what }));
resolved = true;
break;
case "move":
node.push(i18next.t("apresults:MOVE.complete_one", { player, from: r.from, to: r.to }));
resolved = true;
break;
case "eog":
node.push(i18next.t("apresults:EOG.default"));
resolved = true;
break;
}
return resolved;
}

public clone(): CourtGame {
return new CourtGame(this.serialize());
}
Expand Down
17 changes: 17 additions & 0 deletions src/games/minimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,23 @@ export class MinimizeGame extends GameBase {
]
}

public chat(node: string[], player: string, results: APMoveResult[], r: APMoveResult): boolean {
let resolved = false;
switch (r.type) {
case "place": // note that when chat() is invoked, the current player is already updated
node.push(i18next.t("apresults:PLACE.complete", { player, where: r.where,
what: this.board.get(r.where!)! !== this.currplayer ? "friendly piece" :
"opponent piece" }));
resolved = true;
break;
case "eog":
node.push(i18next.t("apresults:EOG.default"));
resolved = true;
break;
}
return resolved;
}

public clone(): MinimizeGame {
return new MinimizeGame(this.serialize());
}
Expand Down
19 changes: 19 additions & 0 deletions src/games/pippinzip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,25 @@ export class PippinzipGame extends GameBase {
};
}

public chat(node: string[], player: string, results: APMoveResult[], r: APMoveResult): boolean {
let resolved = false;
switch (r.type) {
case "place":
node.push(i18next.t("apresults:PLACE.complete", { player, where: r.where, what: "piece" }));
resolved = true;
break;
case "pass":
node.push(i18next.t("apresults:PASS.pippinzip", { player }));
resolved = true;
break;
case "eog":
node.push(i18next.t("apresults:EOG.default"));
resolved = true;
break;
}
return resolved;
}

public clone(): PippinzipGame {
return new PippinzipGame(this.serialize());
}
Expand Down
24 changes: 22 additions & 2 deletions src/games/pollux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ export class PolluxGame extends GameBase {
this.board.set(moves[1], [this.currplayer, 1]);
this.results.push({type: "move", from: moves[0], to: moves[1]});
this.board.set(moves[2], [this.currplayer, 2]);
this.results.push({type: "move", from: moves[1], to: moves[2]});
this.results.push({type: "block", where: moves[2]});
}
}

Expand All @@ -486,6 +486,7 @@ export class PolluxGame extends GameBase {
this.saveState();

if ( this.stack.length === 4 ) {
this.results = [ {type: "pass"} ];
this.lastmove = "pass"
this.currplayer = this.currplayer % 2 + 1 as playerid;
this.saveState();
Expand Down Expand Up @@ -616,7 +617,7 @@ export class PolluxGame extends GameBase {
rep.annotations = [];
if (this.results.length > 0) {
for (const move of this.results) {
if (move.type === "place") {
if (move.type === "block") {
const [x, y] = this.graph.algebraic2coords(move.where!);
rep.annotations.push({type: "enter", targets: [{row: y, col: x}]});
}
Expand Down Expand Up @@ -650,6 +651,25 @@ export class PolluxGame extends GameBase {
return rep;
}

public chat(node: string[], player: string, results: APMoveResult[], r: APMoveResult): boolean {
let resolved = false;
switch (r.type) {
case "move":
node.push(i18next.t("apresults:MOVE.complete", { player, from: r.from, to: r.to, what: "piece" }));
resolved = true;
break;
case "block":
node.push(i18next.t("apresults:PLACE.pollux", { player, where: r.where }));
resolved = true;
break;
case "eog":
node.push(i18next.t("apresults:EOG.default"));
resolved = true;
break;
}
return resolved;
}

public clone(): PolluxGame {
return new PolluxGame(this.serialize());
}
Expand Down
2 changes: 1 addition & 1 deletion src/games/posit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export class PositGame extends GameBase {
resolved = true;
break;
case "move":
node.push(i18next.t("apresults:MOVE.complete", { player, from: r.from, to: r.to, what: "piece" }));
node.push(i18next.t("apresults:MOVE.posit", { player, from: r.from, to: r.to }));
resolved = true;
break;
case "eog":
Expand Down
17 changes: 17 additions & 0 deletions src/games/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,23 @@ export class ProductGame extends GameBase {
scores: [this.getPlayerScore(1), this.getPlayerScore(2)] }];
}

public chat(node: string[], player: string, results: APMoveResult[], r: APMoveResult): boolean {
let resolved = false;
switch (r.type) {
case "place": // note that when chat() is invoked, the current player is already updated
node.push(i18next.t("apresults:PLACE.complete", { player, where: r.where,
what: this.board.get(r.where!)! !== this.currplayer ? "friendly piece" :
"opponent piece" }));
resolved = true;
break;
case "eog":
node.push(i18next.t("apresults:EOG.default"));
resolved = true;
break;
}
return resolved;
}

public clone(): ProductGame {
return new ProductGame(this.serialize());
}
Expand Down
41 changes: 27 additions & 14 deletions src/games/spora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,10 +759,10 @@ export class SporaGame extends GameBase {
for (const cell of cells) {
const prevsize = this.board.has(cell) ? this.board.get(cell)![1] : 0;
this.board.set(cell, [this.currplayer, prevsize + 1]);
this.results.push({ type: "place", where: cell });
this.results.push({ type: "place", where: cell, count: 1 });
captures.push(...this.doCaptures());
if (captures.length > 0) {
this.results.push({ type: "capture", where: [...captures].join(), count: captures.length });
this.results.push({ type: "capture", where: [...captures].join(','), count: captures.length });
}
}
} else { // normal play
Expand All @@ -775,11 +775,11 @@ export class SporaGame extends GameBase {
// first, do the stack placement
const prevsize = this.board.has(placeStack) ? this.board.get(placeStack)![1] : 0;
this.board.set(placeStack, [this.currplayer, prevsize + n]);
this.results = [{type: "place", where: placeStack}]
this.results = [{type: "place", where: placeStack, count: n}]

captures.push(...this.doCaptures());
if (captures.length > 0) {
this.results.push({ type: "capture", where: [...captures].join(), count: captures.length });
this.results.push({ type: "capture", where: [...captures].join(','), count: captures.length });
}

// populate _selected
Expand All @@ -806,14 +806,14 @@ export class SporaGame extends GameBase {
captures.push(...this.doCaptures()); // each sowed piece can capture
}

if (captures.length > 0) {
this.results.push({ type: "capture", where: [...captures].join(), count: captures.length });
}

const sowingPath = [sowingStack, ...cells]
for(let i = 0; i < sowingPath.length-1; i++ ) { // mark path
this.results.push({type: "move", from: sowingPath[i], to: sowingPath[i+1]});
}

if (captures.length > 0) {
this.results.push({ type: "capture", where: [...captures].join(), count: captures.length });
}
return this;
}

Expand All @@ -836,14 +836,14 @@ export class SporaGame extends GameBase {
captures.push(...this.doCaptures()); // each sowed piece can capture
}

if (captures.length > 0) {
this.results.push({ type: "capture", where: [...captures].join(), count: captures.length });
}

const sowingPath = [sowingStack, ...cells]
for(let i = 0; i < sowingPath.length-1; i++ ) { // mark path
this.results.push({type: "move", from: sowingPath[i], to: sowingPath[i+1]});
}

if (captures.length > 0) {
this.results.push({ type: "capture", where: [...captures].join(), count: captures.length });
}
}
}

Expand Down Expand Up @@ -1048,13 +1048,26 @@ export class SporaGame extends GameBase {

public chat(node: string[], player: string, results: APMoveResult[], r: APMoveResult): boolean {
let resolved = false;

switch (r.type) {
case "komi":
node.push(i18next.t("apresults:KOMI", { player, value: r.value }));
resolved = true;
break;
case "play-second":
node.push(i18next.t("apresults:PLAYSECOND", { player }));
resolved = true;
break;
case "place":
node.push(i18next.t("apresults:PLACE.nowhat", { player, where: r.where }));
node.push(i18next.t("apresults:PLACE.spora", { player, where: r.where, size : r.count }));
resolved = true;
break;
case "move":
node.push(i18next.t("apresults:MOVE.spora", { player, from: r.from, to : r.to }));
resolved = true;
break;
case "capture":
node.push(i18next.t("apresults:CAPTURE.noperson.group_nowhere", { player, count: r.count }));
node.push(i18next.t("apresults:CAPTURE.spora", { player, group: r.where!, count: r.count }));
resolved = true;
break;
case "eog":
Expand Down
Loading
Loading