Preserve board layout when checking planning feasibility
This commit is contained in:
parent
18e2518588
commit
cf89ec218c
2 changed files with 23 additions and 0 deletions
|
|
@ -436,6 +436,7 @@ function planningState(s) {
|
|||
const b = copy({
|
||||
players: s.players,
|
||||
board: s.board,
|
||||
boardLayout: s.boardLayout,
|
||||
market: s.market,
|
||||
tourists: s.tourists,
|
||||
demands: s.demands,
|
||||
|
|
|
|||
|
|
@ -246,6 +246,28 @@ test("dropped players are automated on future turns and replay boundaries remain
|
|||
s._frames[n - 1].board,
|
||||
);
|
||||
});
|
||||
test("planning preserves current and legacy board layouts", () => {
|
||||
for (const boardLayout of [2, 1, undefined]) {
|
||||
const s = actionState();
|
||||
s.boardLayout = boardLayout;
|
||||
s.phase = "plan";
|
||||
s.planningPass = 1;
|
||||
s.players[0].boat = "3,1";
|
||||
s.players[0].markers = Object.fromEntries(E.ACTIONS.map((a) => [a, 0]));
|
||||
s.players[0].markers.sail = 1;
|
||||
s.players[0].markers.buy = 1;
|
||||
s.players[0].treasures = [3];
|
||||
const island = boardLayout === 2 ? "4,2" : "3,0";
|
||||
s.board[island] = E.tileState("d1");
|
||||
assert.ok(E.actionOptions(s, 0, "draw").some((m) => m.cell === island));
|
||||
assert.equal(E.canPlan(s, 0, "draw"), true);
|
||||
assert.ok(
|
||||
E.availableMoves(s, 0).some(
|
||||
(m) => m.type === "plan" && m.actions.includes("draw"),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
test("batched planning accounts for the first new marker as a prerequisite", () => {
|
||||
const s = actionState();
|
||||
s.phase = "plan";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue