Skip to content

Commit

Permalink
Pacru: Live testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Perlkonig committed Feb 9, 2025
1 parent 79bf934 commit c7bdff0
Show file tree
Hide file tree
Showing 12 changed files with 1,648 additions and 37 deletions.
20 changes: 20 additions & 0 deletions locales/en/apgames.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"oust": "Oust is the classic \"exnihilation\" game where the game starts with an empty board and the goal is to eliminate all of your opponent's pieces. On your turn, you may make multiple capturing placements if available, but you must end it with a non-capturing placement. You must pass if you are not able to make any placements.",
"oware": "A traditional West African sowing game where you try to capture the most pieces.",
"owlman": "An asymmetrical game where a professor and his assistants are trying to track down the mythical Owlman and his lair, while the Owlman tries to scare them all out of the forest.",
"pacru": "A territory-control game where directional pieces navigate a subdivided board to claim cells.",
"pahtum": "Accumulate points by establishing lines of your own pieces of various lengths, but five cells each game are blocked. A capturing option is also available.",
"penguin": "It is a truth universally acknowledged that everybody loves seeing penguins sliding around on the ice. And soccer is the world's game, right? So take some cute families of penguins, give them an icy soccer field and a ball, and watch the slippery goodness that ensues.",
"pente": "In Pente, players take turns placing stones on the intersections of the board. The first player to get five in a row or capture ten stones wins.",
Expand Down Expand Up @@ -2870,6 +2871,7 @@
"OFFENSE": "Offensive player",
"COUNTDOWN": "Plies remaining"
},
"pacru": "Tiles left to win",
"PHASE": "Phase",
"PIECESINHAND": "Pieces in hand",
"PIECESINHANDSTASH": "Pieces in hand / stash",
Expand Down Expand Up @@ -4129,6 +4131,24 @@
"INITIAL_INSTRUCTIONS": "Select a piece to move.",
"PARTIAL": "Select a destination."
},
"pacru": {
"BAD_CONNECTION": "You requested a connection change even though one was not made.",
"ENEMY_TILE": "You can't land on opposing tiles except by pincer.",
"INITIAL_INSTRUCTIONS": "Select a chevron to move.",
"NEED_DESTINATION": "Select the destination (valid targets are highlighted) or select the same piece again to begin reorientation.",
"ONLY_NEUTRAL": "During a borderland change, you may only convert unoccupied neutral cells.",
"ONLY_OPPOSING": "During a borderland transformation, you may only convert unoccupied opposing cells.",
"OVER_ORIENT": "You may not reorient more than 90 degrees in a single turn.",
"RELINQUISH_EMPTY": "The tile at {{where}} has a chevron. Occupied tiles cannot be relinquished.",
"RELINQUISH_OWN": "The tile at {{where}} does not belong to you and cannot be relinquished.",
"REORIENT": "Click a neighbouring cell or edge zone to select the direction you want to face.",
"SELECT_CELL_blChange": "Borderland change: Select a neutral cell to convert to your colour.",
"SELECT_CELL_blTransform": "Borderland transformation: Select an opposing cell to convert to your colour.",
"SELECT_CELL_both": "You changed borderlands *and* made a connection. Select one of the highlighted cells to convert it to your colour, or select your starting cell to trigger the connection change. You can't do both.",
"SELECT_CELL_meeting": "A meeting has occurred! Select one of the highlighted cells to convert to your colour.",
"SELECT_CELL_orientation_one": "Reorientation: Select one more highlighted cell to relinquish.",
"SELECT_CELL_orientation_other": "Reorientation: Select {{count}} more highlighted cells to relinquish."
},
"pahtum": {
"INITIAL_INSTRUCTIONS_offer": "Place all five blocks. Your opponent will then choose which colour to play.",
"INITIAL_INSTRUCTIONS_response": "Click \"Swap player seats\" to play as first player or pass to remain as second player.",
Expand Down
3 changes: 2 additions & 1 deletion locales/en/apresults.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@
"tablero": "The dice were rolled: {{values}}."
},
"SACRIFICE": {
"moonsquad": "{{player}} sacrificed an ore ({{ore}}) to move their squads."
"moonsquad": "{{player}} sacrificed an ore ({{ore}}) to move their squads.",
"nowhat": "{{player}} sacrificed a piece at {{where}}."
},
"SCORE_REPORT": "{{player}}'s score is now {{score}}.",
"SELECT": {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
"dependencies": {
"@abstractplay/recranks": "latest",
"@abstractplay/renderer": "^1.0.0-ci-13081678951.0",
"@abstractplay/renderer": "^1.0.0-ci-13227419518.0",
"@turf/boolean-contains": "^6.5.0",
"@turf/boolean-intersects": "^6.5.0",
"@turf/boolean-point-in-polygon": "^6.5.0",
Expand Down
4 changes: 2 additions & 2 deletions src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { shuffle } from "./shuffle";
import { UserFacingError } from "./errors";
import { HexTriGraph, SnubSquareGraph, SquareOrthGraph, SquareDiagGraph, SquareGraph, Square3DGraph, SquareDirectedGraph, SquareFanoronaGraph, BaoGraph, SowingNoEndsGraph } from "./graphs";
import { wng } from "./namegenerator";
import { projectPoint, ptDistance, smallestDegreeDiff, normDeg, deg2rad, rad2deg, toggleFacing, calcBearing, matrixRectRot90, matrixRectRotN90, transposeRect, circle2poly, midpoint, distFromCircle } from "./plotting";
import { projectPoint, ptDistance, smallestDegreeDiff, normDeg, deg2rad, rad2deg, toggleFacing, calcBearing, matrixRectRot90, matrixRectRotN90, transposeRect, circle2poly, midpoint, distFromCircle, deg2dir, dir2deg } from "./plotting";
import { hexhexAi2Ap, hexhexAp2Ai, triAi2Ap, triAp2Ai } from "./aiai";
import stringify from "json-stringify-deterministic";
import fnv from "fnv-plus";

export { RectGrid, StackSet, reviver, replacer, sortingReplacer, shuffle, UserFacingError, HexTriGraph, SnubSquareGraph, SquareOrthGraph, SquareDiagGraph, SquareGraph, Square3DGraph, SquareDirectedGraph, SquareFanoronaGraph, BaoGraph, SowingNoEndsGraph, wng, projectPoint, ptDistance, smallestDegreeDiff, normDeg, deg2rad, rad2deg, toggleFacing, calcBearing, matrixRectRot90, matrixRectRotN90, transposeRect, hexhexAi2Ap, hexhexAp2Ai, triAi2Ap, triAp2Ai, circle2poly, midpoint, distFromCircle };
export { RectGrid, StackSet, reviver, replacer, sortingReplacer, shuffle, UserFacingError, HexTriGraph, SnubSquareGraph, SquareOrthGraph, SquareDiagGraph, SquareGraph, Square3DGraph, SquareDirectedGraph, SquareFanoronaGraph, BaoGraph, SowingNoEndsGraph, wng, projectPoint, ptDistance, smallestDegreeDiff, normDeg, deg2rad, rad2deg, toggleFacing, calcBearing, matrixRectRot90, matrixRectRotN90, transposeRect, hexhexAi2Ap, hexhexAp2Ai, triAi2Ap, triAp2Ai, circle2poly, midpoint, distFromCircle, dir2deg, deg2dir };

export type DirectionCardinal = "N" | "E" | "S" | "W";
export type DirectionDiagonal = "NE" | "SE" | "SW" | "NW";
Expand Down
26 changes: 24 additions & 2 deletions src/common/plotting.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { IPoint } from ".";
import { IPoint, Direction } from ".";

export const deg2dir = new Map<number, Direction>([
[0, "N"],
[45, "NE"],
[90, "E"],
[135, "SE"],
[180, "S"],
[225, "SW"],
[270, "W"],
[315, "NW"],
]);

export const dir2deg = new Map<Direction, number>([
["N", 0],
["NE", 45],
["E", 90],
["SE", 135],
["S", 180],
["SW", 225],
["W", 270],
["NW", 315],
]);

/**
* Ensures a degree measurement lies [0, 360)
Expand All @@ -20,7 +42,7 @@ export const deg2rad = (deg: number): number => {
}

/**
* Converts degrees to radians
* Converts radians to degrees
*/
export const rad2deg = (rad: number): number => {
return rad * (180 / Math.PI);
Expand Down
8 changes: 6 additions & 2 deletions src/games/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ import { GyveGame, IGyveState } from "./gyve";
import { PahTumGame, IPahTumState } from "./pahtum";
import { NakattaGame, INakattaState } from "./nakatta";
import { OmnyGame, IOmnyState } from "./omny";
import { PacruGame, IPacruState } from "./pacru";

export {
APGamesInformation, GameBase, GameBaseSimultaneous, IAPGameState,
Expand Down Expand Up @@ -380,6 +381,7 @@ export {
PahTumGame, IPahTumState,
NakattaGame, INakattaState,
OmnyGame, IOmnyState,
PacruGame, IPacruState,
};

const games = new Map<string, typeof AmazonsGame | typeof BlamGame | typeof CannonGame |
Expand Down Expand Up @@ -445,7 +447,7 @@ const games = new Map<string, typeof AmazonsGame | typeof BlamGame | typeof Cann
typeof OwlmanGame | typeof SquaredanceGame | typeof MegGame |
typeof YonmoqueGame | typeof ChameleonGame | typeof KachitGame |
typeof GyveGame | typeof PahTumGame | typeof NakattaGame |
typeof OmnyGame
typeof OmnyGame | typeof PacruGame
>();
// Manually add each game to the following array
[
Expand Down Expand Up @@ -475,7 +477,7 @@ const games = new Map<string, typeof AmazonsGame | typeof BlamGame | typeof Cann
MoonSquadGame, JacynthGame, Pigs2Game, TerraceGame, CubeoGame, StorisendeGame, TraxGame,
AmoebaGame, YavalathGame, ConspirateursGame, CatapultGame, BasaltGame, ChurnGame, PenguinGame,
OwlmanGame, SquaredanceGame, MegGame, YonmoqueGame, ChameleonGame, KachitGame, GyveGame,
PahTumGame, NakattaGame, OmnyGame,
PahTumGame, NakattaGame, OmnyGame, PacruGame,
].forEach((g) => {
if (games.has(g.gameinfo.uid)) {
throw new Error("Another game with the UID '" + g.gameinfo.uid + "' has already been used. Duplicates are not allowed.");
Expand Down Expand Up @@ -863,6 +865,8 @@ export const GameFactory = (game: string, ...args: any[]): GameBase|GameBaseSimu
return new NakattaGame(...args);
case "omny":
return new OmnyGame(...args);
case "pacru":
return new PacruGame(args[0], ...args.slice(1));
}
return;
}
Loading

0 comments on commit c7bdff0

Please sign in to comment.