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
19 changes: 19 additions & 0 deletions locales/en/apgames.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"attangle": "Attangle is the final entry in Dieter Stein's stacking trilogy. Place and move pieces to build stacks. First person to build three triple stacks wins. The \"Grand Attangle\" variant is also implemented.",
"ayu": "Unification game where snaky groups of pieces crawl toward their friends and eventually coalesce. If you cannot make a move on your turn, you win. This occurs when you have only one group or there is no free path between any of your groups.",
"azacru": "A territory-control game where directional pieces navigate a subdivided board to claim cells.",
"bamboo": "Place stones such that no group has more pieces than the number of your groups on the board. Then, be the last player able to move.",
"bao": "A traditional mancala-style sowing game from East Africa where you attempt to eliminate all pieces from the opposing front row or leave them with no legal moves.",
"basalt": "A triangular connection game played on the side of a volcano, where lava and basalt vye to connect the three sides first.",
"bide": "Up to six players take turns placing pieces on the board, pushing adjacent pieces outward. One can also pass to build up a number of pieces that can be placed at once later. Pieces closer to the centre are more valuable. Highest-scoring group wins!",
Expand Down Expand Up @@ -517,6 +518,14 @@
"name": "17x17 board"
}
},
"bamboo": {
"hex6": {
"name": "Hexhex 6 (91 spaces)"
},
"#board": {
"name": "Hexhex 7 (127 spaces)"
}
},
"bao": {
"kujifunza": {
"description": "The \"beginner\" version with no \"kunamua\" setup phase. The game starts with two stones in each pit.",
Expand Down Expand Up @@ -2800,6 +2809,12 @@
"name": "Hide threatened"
}
},
"asli": {
"swap-prison": {
"description": "Swap the color of the pieces in the prison.",
"name": "Swap prison colors"
}
},
"atoll": {
"show-labels": {
"description": "Show labels for each cell.",
Expand Down Expand Up @@ -3622,6 +3637,10 @@
"REORIENT": "Click a neighbouring cell or edge zone to select the direction you want to face.",
"TOO_FAR": "You can't move further than your power of movement (currently {{pom}})."
},
"bamboo": {
"BAD_PLACE": "None of your groups may contain more stones than number of groups of your colour on the board.",
"INITIAL_INSTRUCTIONS": "Select an empty cell to place a stone."
},
"bao": {
"BAD_TAX": "You may only \"tax\" the nyumba if it is the only occupied space on your front row.",
"BLOCKED": "You may not begin a kutakata turn with a pit that is blocked (is in kutakatia).",
Expand Down
13 changes: 8 additions & 5 deletions src/games/asli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GameBase, IAPGameState, IClickResult, ICustomButton, IIndividualState, IValidationResult, IScores } from "./_base";
import { GameBase, IAPGameState, IClickResult, ICustomButton, IIndividualState, IValidationResult, IScores, IRenderOpts } from "./_base";
import { APGamesInformation } from "../schemas/gameinfo";
import { APRenderRep, BoardBasic, MarkerDots, RowCol } from "@abstractplay/renderer/src/schemas/schema";
import { APMoveResult } from "../schemas/moveresults";
Expand Down Expand Up @@ -67,7 +67,8 @@ export class AsliGame extends GameBase {
{uid: "setkomi", group: "komi"},
],
categories: ["goal>immobilize", "mechanic>place", "mechanic>capture", "board>shape>rect", "board>connect>rect", "components>simple>1per"],
flags: ["custom-buttons", "no-moves", "custom-randomization", "scores", "custom-colours"]
flags: ["custom-buttons", "no-moves", "custom-randomization", "scores", "custom-colours"],
displays: [{uid: "swap-prison"}]
};

public coords2algebraic(x: number, y: number): string {
Expand Down Expand Up @@ -683,7 +684,9 @@ export class AsliGame extends GameBase {
};
}

public render(): APRenderRep {
public render(opts?: IRenderOpts): APRenderRep {
const swapPrison = (opts !== undefined && opts.altDisplay !== undefined && opts.altDisplay === "swap-prison");

// Build piece string
let pstr = "";
for (let row = 0; row < this.boardsize; row++) {
Expand Down Expand Up @@ -713,15 +716,15 @@ export class AsliGame extends GameBase {
if (hasPrison) {
prisonPiece.push({
name: "piece",
colour: this.prison[0] > 0 ? this.getPlayerColour(1) : this.getPlayerColour(2),
colour: this.prison[0] > 0 ? this.getPlayerColour(swapPrison ? 2 : 1) : this.getPlayerColour(swapPrison ? 1 : 2),
scale: 0.85,
});
prisonPiece.push({
text: this.prison[0] > 0 ? this.prison[0].toString() : this.prison[1].toString(),
colour: {
func: "bestContrast",
fg: ["_context_background", "_context_fill", "_context_label"],
bg: this.prison[0] > 0 ? this.getPlayerColour(1) : this.getPlayerColour(2),
bg: this.prison[0] > 0 ? this.getPlayerColour(swapPrison ? 2 : 1) : this.getPlayerColour(swapPrison ? 1 : 2),
},
scale: 0.75,
rotate: null,
Expand Down
Loading