Skip to content

Commit 0327821

Browse files
committed
Waldmeister: Going for local testing
1 parent e8fc1bf commit 0327821

File tree

4 files changed

+864
-4
lines changed

4 files changed

+864
-4
lines changed

locales/en/apgames.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@
274274
"toguz": "Depicting state changes in sowing games is challenging. The initial chosen pit is marked, as is any capture. Small numbers appear to show the change in the number of stones in each pit. If you believe you have encountered a bug, please let us know in Discord.",
275275
"tumbleweed": "A space is claimed by a player if they have a piece on it, or if they have the majority of the line of sights to it. The score is the number of territory own by each player. The game ends when both players pass in succession. If there is no change in score for 20 plies, the game also ends.",
276276
"twixt": "The notation is based on Hansel notation at <http://www.ibiblio.org/twixtpuzzles/>. Some modifications are that link removal specifically specifies the link direction, and commas separate the moves. To add/remove links, click on the pegs between them. You can also remove a link by clicking on the line itself.",
277+
"waldmeister": "Players play two games sequentially. In the first round, Player 1 is playing for colours and Player 2 is playing for heights. At the end of the first round, scores are tabulated and scoring groups highlighted. Then in the second round, Player 2 plays first and plays for colours, and Player 1 plays for heights.\n\nWhen customizing, colours 1 and 2 are the player colours, and colours 3, 4, and 5 are the dark green, light green, and yellow green tree colours.",
277278
"witch": "The first player does not start as owning any pieces and may remove any piece (other than a crown) on their first turn. The second player chooses their colour on their first turn, after which, removing your opponent's pieces is no longer possible."
278279
},
279280
"variants": {
@@ -3269,9 +3270,14 @@
32693270
"SCORES": "Scores",
32703271
"STACKSIZES": "Stack heights",
32713272
"tumbleweed": "Score (pieces + influence)",
3272-
"ESTIMATEDSCORES": "Estimated scores",
3273+
"ESTIMATEDSCORES": "Estimated scores",
32733274
"TOPLACE": "Piece to place",
32743275
"valley": "Moon Tokens",
3276+
"waldmeister": {
3277+
"COLOUR": "colours",
3278+
"GOALS": "Goals",
3279+
"HEIGHT": "heights"
3280+
},
32753281
"YEAR": "Year"
32763282
},
32773283
"validation": {
@@ -5623,6 +5629,14 @@
56235629
"SAME_START_END": "The start and end points are the same.",
56245630
"SINGLE_LINE": "The {{range}} is not a straight unbroken line of your birds."
56255631
},
5632+
"waldmeister": {
5633+
"INITIAL_INSTRUCTIONS_move": "Select a piece on the board to move.",
5634+
"INITIAL_INSTRUCTIONS_place": "Select one of your pieces to place on the board.",
5635+
"LABEL_STASH": "Player {{playerNum}}'s stash",
5636+
"PARTIAL_MOVE": "Select the destination.",
5637+
"PARTIAL_MOVE_PLACE": "Select a piece from your hand to place on the board.",
5638+
"PARTIAL_PLACE": "Select a space on the board to place your {{piece}} piece."
5639+
},
56265640
"witch": {
56275641
"2P_PRIVILEGE": "Only the second player may choose the pieces they wish to play.",
56285642
"AFFILIATE": "Choose which piece you wish to play by clicking any sun or moon piece.",

src/common/graphs/hextri.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export class HexTriGraph implements IGraph {
1414
public readonly alternating: boolean;
1515
public readonly perimeter: number;
1616
public graph: UndirectedGraph
17+
private _reverseLetters = false;
1718

1819
constructor(minwidth: number, maxwidth: number, alternating = false) {
1920
if (minwidth >= maxwidth) {
@@ -40,8 +41,20 @@ export class HexTriGraph implements IGraph {
4041

4142
public static directions: HexDir[] = ["NE","E","SE","SW","W","NW"];
4243

44+
public set reverseLetters(val: boolean) {
45+
this._reverseLetters = val;
46+
}
47+
48+
public get reverseLetters(): boolean {
49+
return this._reverseLetters;
50+
}
51+
4352
public coords2algebraic(x: number, y: number): string {
44-
return columnLabels[this.height - y - 1] + (x + 1).toString();
53+
let idx = this.height - y - 1;
54+
if (this.reverseLetters) {
55+
idx = (this.height - 1) - idx;
56+
}
57+
return columnLabels[idx] + (x + 1).toString();
4558
}
4659

4760
public algebraic2coords(cell: string): [number, number] {
@@ -56,7 +69,10 @@ export class HexTriGraph implements IGraph {
5669
throw new Error(`The row label is invalid: ${pair[0]}`);
5770
}
5871

59-
const realY = this.height - y - 1;
72+
let realY = this.height - y - 1;
73+
if (this.reverseLetters) {
74+
realY = (this.height - 1) - realY;
75+
}
6076
const delta = Math.abs(realY - this.midrow);
6177
const rowWidth = this.maxwidth - delta;
6278
if ( (x < 0) || (x > rowWidth) ) {

src/games/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ import { RampartGame, IRampartState } from "./rampart";
221221
import { KrypteGame, IKrypteState } from "./krypte";
222222
import { EnsoGame, IEnsoState } from "./enso";
223223
import { RincalaGame, IRincalaState } from "./rincala";
224+
import { WaldMeisterGame, IWaldMeisterState } from "./waldmeister";
224225

225226
export {
226227
APGamesInformation, GameBase, GameBaseSimultaneous, IAPGameState,
@@ -445,6 +446,7 @@ export {
445446
KrypteGame, IKrypteState,
446447
EnsoGame, IEnsoState,
447448
RincalaGame, IRincalaState,
449+
WaldMeisterGame, IWaldMeisterState,
448450
};
449451

450452
const games = new Map<string, typeof AmazonsGame | typeof BlamGame | typeof CannonGame |
@@ -522,7 +524,7 @@ const games = new Map<string, typeof AmazonsGame | typeof BlamGame | typeof Cann
522524
typeof SunspotGame | typeof StawvsGame | typeof LascaGame |
523525
typeof EmergoGame | typeof FroggerGame | typeof ArimaaGame |
524526
typeof RampartGame | typeof KrypteGame | typeof EnsoGame |
525-
typeof RincalaGame
527+
typeof RincalaGame | typeof WaldMeisterGame
526528
>();
527529
// Manually add each game to the following array
528530
[
@@ -557,6 +559,7 @@ const games = new Map<string, typeof AmazonsGame | typeof BlamGame | typeof Cann
557559
BloqueoGame, PilastriGame, TessellaGame, GorogoGame, BiscuitGame, QuincunxGame,
558560
SiegeOfJGame, StairsGame, EmuGame, DeckfishGame, BluestoneGame, SunspotGame, StawvsGame,
559561
LascaGame, EmergoGame, FroggerGame, ArimaaGame, RampartGame, KrypteGame, EnsoGame, RincalaGame,
562+
WaldMeisterGame,
560563
].forEach((g) => {
561564
if (games.has(g.gameinfo.uid)) {
562565
throw new Error("Another game with the UID '" + g.gameinfo.uid + "' has already been used. Duplicates are not allowed.");
@@ -1010,6 +1013,8 @@ export const GameFactory = (game: string, ...args: any[]): GameBase|GameBaseSimu
10101013
return new EnsoGame(...args);
10111014
case "rincala":
10121015
return new RincalaGame(...args);
1016+
case "waldmeister":
1017+
return new WaldMeisterGame(...args);
10131018
}
10141019
return;
10151020
}

0 commit comments

Comments
 (0)