SwitzerlandCustom: a new community custom map (#173)

* SwitzerlandCustom: a new custom map (Alpine hydro, neutral Geneva, helicopters)

The seven Swiss Grossregionen, 49 cities, 95 links priced from real distances
(+6 into an Alpine city, +2 over a named pass; Gotthard 16).

- Alpine hydro: each ecological or fusion plant fired powers one more city,
  but only as many of those plants as the player owns Alpine cities
  (City.alpine; alpineBonusLeft / alpineEligible; calculateMaxCitiesPowered).
- Geneva is neutral: all three spaces open from Step 1 (stepSlots [3,3,3]).
- Lake Geneva steamer (sea), Glacier Express, three outskirt helicopters
  (Connection.air, drawn dotted and curved clear of cities). The Glacier
  Express, Oberalp and helicopters never decide which regions are dealt
  together; Ticino gets the Gotthard Base Tunnel and the Lukmanier.
- Viewer: Swiss outline (landlocked: neighbours all round), and the faded
  unplayed regions now cover community custom maps too, without curved links.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* SwitzerlandCustom: green plants only for the Alpine +1; an expensive country

- The Alpine +1 is for green (ecological) plants only, never fusion (John:
  6 + 1 = 7 from one card is too strong). Rules text says so explicitly.
- Starting market: coal opens at $3 and oil at $4, while cheese is plentiful
  and opens at $5; uranium as usual ([18, 15, 12, 2], both editions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the Central Europe comment on garbagePrice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* SwitzerlandCustom: power plants send the engine's offer; Alpine peaks

Found in John's local playtest: the viewer built its own UsePowerPlant move
from the printed card, so the engine refused a green plant with the Alpine
+1. A single-fuel plant now sends the engine's own offer (hybrids keep the
mix the player picked). freePlantMoves takes each offer after the previous
plant fires (on a copy), since the Alpine +1 is shared out; the powered-cities
count includes it. A snow-capped peak sits behind each Alpine city.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* SwitzerlandCustom: cheese opens at $6 (John, after his playtest)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* SwitzerlandCustom: the building-phase power capacity counts the Alpine +1

Found in John's playtest: 18 + 30 + 20 with Alpine cities showed 13, not 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* SwitzerlandCustom: the Glacier Express drawn as a red railway

Connection.rail (visual only): red rails over a pale bed, crossed by red ties.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
goldjohn6 2026-11-20 11:06:59 -08:00 • committed by GitHub
commit d0f8c48547
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 614 additions and 30 deletions

View file

@ -9,7 +9,7 @@ import { GameState, MapName, Player, PowerPlantType } from './gamestate';
// custom map that graduates gets one then. A new custom map must be added here,
// so the choice is made on purpose. The lookup below already handles a map
// with no badge.
type CustomMapName = 'HawaiiCustom';
type CustomMapName = 'HawaiiCustom' | 'SwitzerlandCustom';
const mapAchievements: Record<Exclude<MapName, CustomMapName>, string> = {
Germany: 'germany-champion',
USA: 'usa-champion',

View file

@ -7,6 +7,7 @@ import {
Phase,
Player,
playerColors,
PowerPlant,
PowerPlantType,
ResourceType,
} from './gamestate';
@ -15,6 +16,30 @@ import { MoveName } from './move';
import prices from './prices';
import { minBy } from './utils';
/** SwitzerlandCustom: the plants the Alpine +1 applies to — the green (ecological) plants only, never fusion. */
export function alpineEligible(pp: PowerPlant): boolean {
return pp.type == PowerPlantType.Wind;
}
/** SwitzerlandCustom: the Alpine cities the player owns. */
export function alpineCitiesOwned(G: GameState, player: Player): number {
const alpine = new Set(G.map.cities.filter((c) => c.alpine).map((c) => c.name));
return alpine.size ? player.cities.filter((c) => alpine.has(c.name)).length : 0;
}
/**
* SwitzerlandCustom, Bureaucracy: how many more ecological plants still get the Alpine +1 this round.
* Each ecological plant fired powers one more city, up to the number of Alpine cities owned.
*/
export function alpineBonusLeft(G: GameState, player: Player): number {
const owned = alpineCitiesOwned(G, player);
if (!owned) return 0;
const fired = player.powerPlants.filter(
(pp) => alpineEligible(pp) && !player.powerPlantsNotUsed.includes(pp.number)
).length;
return Math.max(0, owned - fired);
}
// Central Europe: a player whose network includes Wien buys garbage $1 cheaper, but
// never for less than $1 ("his cost per piece may not be 0" — Original and Recharged).
export function garbagePrice(G: GameState, player: Player, printedPrice: number): number {
@ -596,7 +621,9 @@ export function availableMoves(G: GameState, player: Player): AvailableMoves {
toUse.push({
powerPlant: powerPlant.number,
resourcesSpent: [],
citiesPowered: powerPlant.citiesPowered,
citiesPowered:
powerPlant.citiesPowered +
(alpineEligible(powerPlant) && alpineBonusLeft(G, player) > 0 ? 1 : 0),
});
break;

View file

@ -3,6 +3,8 @@ import { cloneDeep, isEqual, range } from 'lodash';
import seedrandom from 'seedrandom';
import { applyAnalysisMoney, isAnalysisMoneyCommand } from './analysis-money';
import {
alpineCitiesOwned,
alpineEligible,
availableMoves,
buildOptions,
coalOilOverCapacity,
@ -3231,10 +3233,14 @@ export function calculateMaxCitiesPowered(G: GameState, player: Player) {
permutations.push(perm);
}
const alpineOwned = alpineCitiesOwned(G, player);
let max = 0;
permutations.forEach((permutation) => {
if (isValid(player, permutation)) {
const citiesPowered = permutation.map((p) => p.citiesPowered).reduce((a, b) => a + b, 0);
const citiesPowered =
permutation.map((p) => p.citiesPowered).reduce((a, b) => a + b, 0) +
// SwitzerlandCustom: +1 per ecological plant, capped by the Alpine cities owned.
Math.min(alpineOwned, permutation.filter(alpineEligible).length);
max = Math.max(max, citiesPowered);
}
});

View file

@ -35,7 +35,8 @@ export type MapName =
| 'Bremen'
| 'Manhattan'
| 'Chile'
| 'HawaiiCustom';
| 'HawaiiCustom'
| 'SwitzerlandCustom';
export type Variant = 'original' | 'recharged';
// 'standard' is the base game's deck; deck1 and deck2 are The New Power Plants
// (Set 1) and Set 2. 'shuffled' plays every plant of all three decks together;

View file

@ -25,6 +25,7 @@ import { map as quebec } from './maps/quebec';
import { map as russia } from './maps/russia';
import { map as southafrica } from './maps/southafrica';
import { map as spainportugal } from './maps/spainportugal';
import { map as switzerland } from './maps/switzerland';
import { map as ukireland } from './maps/ukireland';
export interface City {
@ -64,6 +65,9 @@ export interface City {
// Chile: the grid this city belongs to. Until Step 3 a player with cities buys only from their grid's market
// (North, or the main market for Central).
grid?: 'North' | 'Central';
// SwitzerlandCustom: an Alpine city. Each ecological plant its owner fires powers one more city,
// up to the number of Alpine cities that player owns (see alpineBonusLeft).
alpine?: boolean;
}
export interface Connection {
@ -74,6 +78,10 @@ export interface Connection {
via?: [number, number];
// Purely visual: a sea crossing, drawn as a dashed blue line. Pricing is unchanged.
sea?: boolean;
// Purely visual: an air link (SwitzerlandCustom's helicopters), drawn dotted. Pricing is unchanged.
air?: boolean;
// Purely visual: a railway (SwitzerlandCustom's Glacier Express), drawn as red rails with ties. Pricing is unchanged.
rail?: boolean;
// Does not count when deciding which regions are neighbours (region selection).
// The link itself still exists whenever both of its cities are in play.
ignoreForRegions?: boolean;
@ -194,7 +202,7 @@ export interface GameMap {
}
// Community custom maps: selectable by name, never drawn by 'Random'.
export const customMaps: GameMap[] = [hawaii];
export const customMaps: GameMap[] = [hawaii, switzerland];
export const maps: GameMap[] = [
america,

View file

@ -0,0 +1,235 @@
import { GameMap } from './../maps';
// SwitzerlandCustom: a community custom map (draft). The seven Swiss Grossregionen.
// Flat, dense north; Alpine south with dear links (+6 into an Alpine city, +2 over a named pass).
// Link prices come from the real distances; the layout is spread for legibility.
// Generated by .drafts/switzerland/gen_swiss.py.
export enum Regions {
Blue = 'blue', // Lake Geneva
Yellow = 'yellow', // Espace Mittelland (Bern, Bernese Oberland)
Purple = 'purple', // Northwestern (Basel, Aargau)
Red = 'red', // Zurich
Green = 'green', // Eastern (St. Gallen, Graubunden)
Cyan = 'cyan', // Central (Lucerne)
Pink = 'pink', // Ticino
}
export enum Cities {
Geneva = 'Geneva',
Nyon = 'Nyon',
Lausanne = 'Lausanne',
Montreux = 'Montreux',
Sion = 'Sion',
Zermatt = 'Zermatt',
Yverdon = 'Yverdon',
Neuchatel = 'Neuchatel',
Biel = 'Biel',
Bern = 'Bern',
Fribourg = 'Fribourg',
Thun = 'Thun',
Interlaken = 'Interlaken',
Grindelwald = 'Grindelwald',
Basel = 'Basel',
Liestal = 'Liestal',
Rheinfelden = 'Rheinfelden',
Aarau = 'Aarau',
Brugg = 'Brugg',
Baden = 'Baden',
Zofingen = 'Zofingen',
Zurich = 'Zurich',
Winterthur = 'Winterthur',
Kloten = 'Kloten',
Uster = 'Uster',
Dietikon = 'Dietikon',
Wadenswil = 'Wadenswil',
Bulach = 'Bulach',
Schaffhausen = 'Schaffhausen',
Frauenfeld = 'Frauenfeld',
StGallen = 'St. Gallen',
Appenzell = 'Appenzell',
Chur = 'Chur',
Davos = 'Davos',
StMoritz = 'St. Moritz',
Lucerne = 'Lucerne',
Zug = 'Zug',
Schwyz = 'Schwyz',
Altdorf = 'Altdorf',
Engelberg = 'Engelberg',
Andermatt = 'Andermatt',
Sarnen = 'Sarnen',
Airolo = 'Airolo',
Bellinzona = 'Bellinzona',
Locarno = 'Locarno',
Lugano = 'Lugano',
Mendrisio = 'Mendrisio',
Biasca = 'Biasca',
Chiasso = 'Chiasso',
}
export const map: GameMap = {
name: 'SwitzerlandCustom',
cities: [
{ name: Cities.Geneva, region: Regions.Blue, x: 110, y: 950, stepSlots: [3, 3, 3] },
{ name: Cities.Nyon, region: Regions.Blue, x: 149, y: 837 },
{ name: Cities.Lausanne, region: Regions.Blue, x: 264, y: 779 },
{ name: Cities.Montreux, region: Regions.Blue, x: 373, y: 830 },
{ name: Cities.Sion, region: Regions.Blue, x: 512, y: 922 },
{ name: Cities.Zermatt, region: Regions.Blue, x: 640, y: 1023, alpine: true },
{ name: Cities.Yverdon, region: Regions.Blue, x: 276, y: 658 },
{ name: Cities.Neuchatel, region: Regions.Yellow, x: 368, y: 553 },
{ name: Cities.Biel, region: Regions.Yellow, x: 468, y: 476 },
{ name: Cities.Bern, region: Regions.Yellow, x: 543, y: 570 },
{ name: Cities.Fribourg, region: Regions.Yellow, x: 438, y: 650 },
{ name: Cities.Thun, region: Regions.Yellow, x: 551, y: 690 },
{ name: Cities.Interlaken, region: Regions.Yellow, x: 671, y: 698 },
{ name: Cities.Grindelwald, region: Regions.Yellow, x: 773, y: 761, alpine: true },
{ name: Cities.Basel, region: Regions.Purple, x: 539, y: 243 },
{ name: Cities.Liestal, region: Regions.Purple, x: 573, y: 359 },
{ name: Cities.Rheinfelden, region: Regions.Purple, x: 656, y: 266 },
{ name: Cities.Aarau, region: Regions.Purple, x: 691, y: 381 },
{ name: Cities.Brugg, region: Regions.Purple, x: 744, y: 154 },
{ name: Cities.Baden, region: Regions.Purple, x: 776, y: 270 },
{ name: Cities.Zofingen, region: Regions.Purple, x: 618, y: 476 },
{ name: Cities.Zurich, region: Regions.Red, x: 965, y: 420 },
{ name: Cities.Winterthur, region: Regions.Red, x: 997, y: 229 },
{ name: Cities.Kloten, region: Regions.Red, x: 911, y: 313 },
{ name: Cities.Uster, region: Regions.Red, x: 1051, y: 336 },
{ name: Cities.Dietikon, region: Regions.Red, x: 811, y: 385 },
{ name: Cities.Wadenswil, region: Regions.Red, x: 1064, y: 487 },
{ name: Cities.Bulach, region: Regions.Red, x: 873, y: 199 },
{ name: Cities.Schaffhausen, region: Regions.Green, x: 959, y: 115 },
{ name: Cities.Frauenfeld, region: Regions.Green, x: 1117, y: 224 },
{ name: Cities.StGallen, region: Regions.Green, x: 1217, y: 319 },
{ name: Cities.Appenzell, region: Regions.Green, x: 1169, y: 429 },
{ name: Cities.Chur, region: Regions.Green, x: 1223, y: 626 },
{ name: Cities.Davos, region: Regions.Green, x: 1340, y: 651, alpine: true },
{ name: Cities.StMoritz, region: Regions.Green, x: 1327, y: 793, alpine: true },
{ name: Cities.Lucerne, region: Regions.Cyan, x: 730, y: 518 },
{ name: Cities.Zug, region: Regions.Cyan, x: 868, y: 490 },
{ name: Cities.Schwyz, region: Regions.Cyan, x: 967, y: 558 },
{ name: Cities.Altdorf, region: Regions.Cyan, x: 1009, y: 670 },
{ name: Cities.Engelberg, region: Regions.Cyan, x: 889, y: 649, alpine: true },
{ name: Cities.Andermatt, region: Regions.Cyan, x: 930, y: 762, alpine: true },
{ name: Cities.Sarnen, region: Regions.Cyan, x: 771, y: 631 },
{ name: Cities.Airolo, region: Regions.Pink, x: 879, y: 871, alpine: true },
{ name: Cities.Bellinzona, region: Regions.Pink, x: 1103, y: 925 },
{ name: Cities.Locarno, region: Regions.Pink, x: 976, y: 943 },
{ name: Cities.Lugano, region: Regions.Pink, x: 1053, y: 1034 },
{ name: Cities.Mendrisio, region: Regions.Pink, x: 983, y: 1132 },
{ name: Cities.Biasca, region: Regions.Pink, x: 1026, y: 834 },
{ name: Cities.Chiasso, region: Regions.Pink, x: 1104, y: 1143 },
],
connections: [
{ nodes: [Cities.Geneva, Cities.Nyon], cost: 5 },
{ nodes: [Cities.Nyon, Cities.Lausanne], cost: 8 },
{ nodes: [Cities.Lausanne, Cities.Montreux], cost: 6 },
{ nodes: [Cities.Lausanne, Cities.Fribourg], cost: 13 },
{ nodes: [Cities.Montreux, Cities.Sion], cost: 10 },
{ nodes: [Cities.Montreux, Cities.Fribourg], cost: 11 },
{ nodes: [Cities.Sion, Cities.Zermatt], cost: 16 },
{ nodes: [Cities.Zermatt, Cities.Thun], cost: 29 }, // Lotschberg
{ nodes: [Cities.Sion, Cities.Thun], cost: 18 }, // pass
{ nodes: [Cities.Neuchatel, Cities.Biel], cost: 7 },
{ nodes: [Cities.Neuchatel, Cities.Bern], cost: 10 },
{ nodes: [Cities.Biel, Cities.Bern], cost: 7 },
{ nodes: [Cities.Bern, Cities.Fribourg], cost: 7 },
{ nodes: [Cities.Bern, Cities.Thun], cost: 6 },
{ nodes: [Cities.Thun, Cities.Interlaken], cost: 5 },
{ nodes: [Cities.Interlaken, Cities.Grindelwald], cost: 10 },
{ nodes: [Cities.Grindelwald, Cities.Andermatt], cost: 19 }, // Grimsel
{ nodes: [Cities.Bern, Cities.Lucerne], cost: 17 },
{ nodes: [Cities.Biel, Cities.Liestal], cost: 13 },
{ nodes: [Cities.Basel, Cities.Rheinfelden], cost: 4 },
{ nodes: [Cities.Basel, Cities.Liestal], cost: 3 },
{ nodes: [Cities.Liestal, Cities.Rheinfelden], cost: 3 },
{ nodes: [Cities.Liestal, Cities.Aarau], cost: 6 },
{ nodes: [Cities.Rheinfelden, Cities.Brugg], cost: 8 },
{ nodes: [Cities.Aarau, Cities.Brugg], cost: 4 },
{ nodes: [Cities.Brugg, Cities.Baden], cost: 3 },
{ nodes: [Cities.Baden, Cities.Dietikon], cost: 3 },
{ nodes: [Cities.Aarau, Cities.Lucerne], cost: 11 },
{ nodes: [Cities.Dietikon, Cities.Zurich], cost: 3 },
{ nodes: [Cities.Zurich, Cities.Kloten], cost: 3 },
{ nodes: [Cities.Kloten, Cities.Winterthur], cost: 3 },
{ nodes: [Cities.Zurich, Cities.Uster], cost: 3 },
{ nodes: [Cities.Uster, Cities.Winterthur], cost: 4 },
{ nodes: [Cities.Zurich, Cities.Wadenswil], cost: 5 },
{ nodes: [Cities.Wadenswil, Cities.Zug], cost: 3 },
{ nodes: [Cities.Zurich, Cities.Zug], cost: 6 },
{ nodes: [Cities.Winterthur, Cities.Schaffhausen], cost: 6 },
{ nodes: [Cities.Winterthur, Cities.Frauenfeld], cost: 4 },
{ nodes: [Cities.Wadenswil, Cities.Schwyz], cost: 6 },
{ nodes: [Cities.Uster, Cities.StGallen], cost: 13 },
{ nodes: [Cities.Schaffhausen, Cities.Frauenfeld], cost: 6 },
{ nodes: [Cities.Frauenfeld, Cities.StGallen], cost: 10 },
{ nodes: [Cities.StGallen, Cities.Appenzell], cost: 3 },
{ nodes: [Cities.Appenzell, Cities.Chur], cost: 14 },
{ nodes: [Cities.StGallen, Cities.Chur], cost: 16 },
{ nodes: [Cities.Chur, Cities.Davos], cost: 12 },
{ nodes: [Cities.Davos, Cities.StMoritz], cost: 16 }, // Fluela
{ nodes: [Cities.Chur, Cities.StMoritz], cost: 19 }, // Albula
{ nodes: [Cities.Chur, Cities.Bellinzona], cost: 23 }, // San Bernardino
{ nodes: [Cities.Chur, Cities.Andermatt], cost: 27, ignoreForRegions: true }, // Oberalp
{ nodes: [Cities.Lucerne, Cities.Zug], cost: 5 },
{ nodes: [Cities.Zug, Cities.Schwyz], cost: 5 },
{ nodes: [Cities.Lucerne, Cities.Schwyz], cost: 7 },
{ nodes: [Cities.Schwyz, Cities.Altdorf], cost: 4 },
{ nodes: [Cities.Lucerne, Cities.Engelberg], cost: 13 },
{ nodes: [Cities.Engelberg, Cities.Altdorf], cost: 13 }, // Surenen
{ nodes: [Cities.Altdorf, Cities.Andermatt], cost: 13 },
{ nodes: [Cities.Andermatt, Cities.Airolo], cost: 16 }, // Gotthard
{ nodes: [Cities.Bellinzona, Cities.Locarno], cost: 4 },
{ nodes: [Cities.Bellinzona, Cities.Lugano], cost: 5 },
{ nodes: [Cities.Locarno, Cities.Lugano], cost: 6 },
{ nodes: [Cities.Lugano, Cities.Mendrisio], cost: 4 },
{ nodes: [Cities.Airolo, Cities.Biasca], cost: 14 },
{ nodes: [Cities.Biasca, Cities.Bellinzona], cost: 5 },
{ nodes: [Cities.Mendrisio, Cities.Chiasso], cost: 3 },
{ nodes: [Cities.Lugano, Cities.Chiasso], cost: 5 },
{ nodes: [Cities.Aarau, Cities.Zofingen], cost: 3 },
{ nodes: [Cities.Zofingen, Cities.Lucerne], cost: 10 },
{ nodes: [Cities.Liestal, Cities.Zofingen], cost: 9 }, // Hauenstein
{ nodes: [Cities.Bern, Cities.Zofingen], cost: 13 },
{ nodes: [Cities.Kloten, Cities.Bulach], cost: 3 },
{ nodes: [Cities.Bulach, Cities.Schaffhausen], cost: 5 },
{ nodes: [Cities.Bulach, Cities.Baden], cost: 5 },
{ nodes: [Cities.Bulach, Cities.Winterthur], cost: 3 },
{ nodes: [Cities.Lucerne, Cities.Sarnen], cost: 4 },
{ nodes: [Cities.Sarnen, Cities.Interlaken], cost: 11 }, // Brunig
{ nodes: [Cities.Sarnen, Cities.Engelberg], cost: 10 },
{ nodes: [Cities.Lausanne, Cities.Yverdon], cost: 7 },
{ nodes: [Cities.Yverdon, Cities.Neuchatel], cost: 8 },
{ nodes: [Cities.Yverdon, Cities.Fribourg], cost: 10 },
{ nodes: [Cities.Altdorf, Cities.Biasca], cost: 18 }, // Gotthard Base Tunnel
{ nodes: [Cities.Biasca, Cities.Chur], cost: 19 }, // Lukmanier
{ nodes: [Cities.Zurich, Cities.Winterthur], cost: 5 },
{ nodes: [Cities.Zurich, Cities.Baden], cost: 5 },
{ nodes: [Cities.Uster, Cities.Wadenswil], cost: 3 },
{ nodes: [Cities.Biel, Cities.Zofingen], cost: 14 },
{ nodes: [Cities.Winterthur, Cities.StGallen], cost: 13 },
{ nodes: [Cities.Dietikon, Cities.Zug], cost: 7 },
{ nodes: [Cities.Neuchatel, Cities.Fribourg], cost: 7 },
{ nodes: [Cities.Montreux, Cities.Interlaken], cost: 22 }, // GoldenPass
// Lake Geneva steamer: the shore road east of Geneva is French, so Geneva's second way out is the boat.
{ nodes: [Cities.Geneva, Cities.Montreux], cost: 14, sea: true },
// The Glacier Express (Zermatt - Furka - Andermatt).
{ nodes: [Cities.Zermatt, Cities.Andermatt], cost: 18, rail: true, ignoreForRegions: true },
// Helicopters: the outskirts only, never cross-country.
{ nodes: [Cities.Zermatt, Cities.Mendrisio], cost: 20, air: true, ignoreForRegions: true },
{ nodes: [Cities.Mendrisio, Cities.StMoritz], cost: 20, air: true, ignoreForRegions: true, via: [1197, 1005] },
{ nodes: [Cities.Schaffhausen, Cities.Basel], cost: 20, air: true, ignoreForRegions: true, via: [708, 45] },
],
layout: 'Landscape',
// An expensive country: coal opens at $3, oil at $4, cheese at $6; uranium as usual.
startingResources: [18, 15, 9, 2],
mapSpecificRules:
'Alpine cities (Zermatt, Grindelwald, Engelberg, Andermatt, Airolo, Davos, St. Moritz) are dear to reach, but hydro ' +
'pays: each green (ecological) plant you fire powers one more city, but only as many of your green plants as you own ' +
'Alpine cities get it. A plant never gets more than +1 (one green plant and seven Alpine cities is still +1). ' +
'Fusion and fuel-burning plants never get it, ' +
'and you still never power more cities than you own. It follows the plant type, so it works with every deck. ' +
'Switzerland is expensive: coal opens at $3, oil at $4 and cheese at $6. ' +
'Geneva is neutral ground: all three of its spaces are open from Step 1. ' +
'The dotted blue link is the Lake Geneva steamer; the Glacier Express runs Zermatt to Andermatt.',
};

View file

@ -0,0 +1,155 @@
import { expect } from 'chai';
import { alpineBonusLeft, availableMoves } from './available-moves';
import { calculateMaxCitiesPowered, setup } from './engine';
import { GameState, Phase, Player, PowerPlant, PowerPlantType } from './gamestate';
import { map as switzerland } from './maps/switzerland';
import { MoveName } from './move';
const wind = (number: number, citiesPowered: number): PowerPlant => ({
number,
type: PowerPlantType.Wind,
cost: 0,
citiesPowered,
});
const coal = (number: number, citiesPowered: number): PowerPlant => ({
number,
type: PowerPlantType.Coal,
cost: 2,
citiesPowered,
});
/** A Bureaucracy-phase game with the whole Swiss board, and player 0 holding these plants and cities. */
function bureaucracy(plants: PowerPlant[], cities: string[], coalLeft = 0): { G: GameState; player: Player } {
const G = setup(3, { map: 'SwitzerlandCustom', variant: 'original' }, 'swiss');
G.map = JSON.parse(JSON.stringify(switzerland));
G.phase = Phase.Bureaucracy;
const player = G.players[0];
player.powerPlants = plants;
player.powerPlantsNotUsed = plants.map((p) => p.number);
player.cities = cities.map((name) => ({ name, position: 0 }));
player.coalLeft = coalLeft;
return { G, player };
}
const offered = (G: GameState, player: Player) =>
(availableMoves(G, player)[MoveName.UsePowerPlant] ?? []) as { powerPlant: number; citiesPowered: number }[];
const powers = (G: GameState, player: Player, plant: number) =>
offered(G, player).find((m) => m.powerPlant == plant)!.citiesPowered;
describe('SwitzerlandCustom', () => {
it('is never dealt by Random', () => {
for (let s = 0; s < 300; s++) {
for (const variant of ['original', 'recharged'] as const) {
expect(setup(3, { map: 'Random', variant }, 'r' + s).map.name).to.not.equal('SwitzerlandCustom');
}
}
});
it('has 49 cities, 7 per region, every city linked, no duplicate links', () => {
const byRegion = new Map<string, number>();
switzerland.cities.forEach((c) => byRegion.set(c.region, (byRegion.get(c.region) ?? 0) + 1));
expect(switzerland.cities.length).to.equal(49);
expect([...byRegion.values()]).to.deep.equal([7, 7, 7, 7, 7, 7, 7]);
const names = new Set(switzerland.cities.map((c) => c.name));
const seen = new Set<string>();
const degree = new Map<string, number>();
for (const l of switzerland.connections) {
l.nodes.forEach((n) => expect(names.has(n), n).to.equal(true));
const k = [...l.nodes].sort().join('|');
expect(seen.has(k), k).to.equal(false);
seen.add(k);
l.nodes.forEach((n) => degree.set(n, (degree.get(n) ?? 0) + 1));
}
for (const n of names) expect(degree.get(n) ?? 0, n).to.be.at.least(2);
});
it('deals every player count a playable board', () => {
for (let players = 2; players <= 6; players++) {
for (let s = 0; s < 50; s++) {
const G = setup(players, { map: 'SwitzerlandCustom', variant: 'original' }, 'p' + s);
expect(G.map.name).to.equal('SwitzerlandCustom');
expect(G.map.cities.length).to.be.greaterThan(0);
}
}
});
it('is an expensive country: coal from $3, oil from $4, cheese from $6, uranium as usual', () => {
for (const variant of ['original', 'recharged'] as const) {
const G = setup(4, { map: 'SwitzerlandCustom', variant }, 'prices');
expect([G.coalMarket, G.oilMarket, G.garbageMarket, G.uraniumMarket], variant).to.deep.equal([
18, 15, 9, 2,
]);
}
});
it("opens all three of Geneva's spaces from Step 1, and only Geneva's", () => {
for (const c of switzerland.cities) {
expect(c.stepSlots, c.name).to.deep.equal(c.name == 'Geneva' ? [3, 3, 3] : undefined);
}
});
it('marks the seven Alpine cities', () => {
expect(
switzerland.cities
.filter((c) => c.alpine)
.map((c) => c.name)
.sort()
).to.deep.equal(['Airolo', 'Andermatt', 'Davos', 'Engelberg', 'Grindelwald', 'St. Moritz', 'Zermatt'].sort());
});
describe('Alpine hydro: +1 per ecological plant, capped by Alpine cities owned', () => {
it('gives nothing without an Alpine city', () => {
const { G, player } = bureaucracy([wind(13, 1)], ['Bern', 'Thun']);
expect(powers(G, player, 13)).to.equal(1);
expect(calculateMaxCitiesPowered(G, player)).to.equal(1);
});
it('gives one ecological plant +1 with one Alpine city, and not the second', () => {
const { G, player } = bureaucracy([wind(13, 1), wind(18, 2)], ['Zermatt', 'Bern', 'Thun', 'Sion', 'Biel']);
expect(alpineBonusLeft(G, player)).to.equal(1);
expect(powers(G, player, 13)).to.equal(2);
expect(powers(G, player, 18)).to.equal(3);
// fire 18 with the bonus: the bonus is spent, 13 is back to its printed value
player.powerPlantsNotUsed = [13];
expect(alpineBonusLeft(G, player)).to.equal(0);
expect(powers(G, player, 13)).to.equal(1);
// best case across both: 1 + 2 + one bonus
player.powerPlantsNotUsed = [13, 18];
expect(calculateMaxCitiesPowered(G, player)).to.equal(4);
});
it('gives both ecological plants +1 with two Alpine cities', () => {
const { G, player } = bureaucracy(
[wind(13, 1), wind(18, 2)],
['Zermatt', 'Davos', 'Bern', 'Thun', 'Sion', 'Biel']
);
expect(calculateMaxCitiesPowered(G, player)).to.equal(5);
player.powerPlantsNotUsed = [13];
expect(powers(G, player, 13)).to.equal(2);
});
it('never boosts fuelled plants, and never powers more cities than owned', () => {
const { G, player } = bureaucracy([coal(10, 2), wind(13, 1)], ['Zermatt', 'Bern'], 2);
expect(powers(G, player, 10)).to.equal(2);
expect(powers(G, player, 13)).to.equal(2);
expect(calculateMaxCitiesPowered(G, player)).to.equal(2);
});
it('never boosts the fusion plant (John, 2026-11-19: 6 + 1 = 7 from one card is too strong)', () => {
const fusion: PowerPlant = { number: 50, type: PowerPlantType.Nuclear, cost: 0, citiesPowered: 6 };
const cities = ['Zermatt', 'Bern', 'Thun', 'Sion', 'Biel', 'Lausanne', 'Nyon', 'Montreux'];
const { G, player } = bureaucracy([fusion, wind(13, 1)], cities);
expect(powers(G, player, 50)).to.equal(6);
// the one Alpine +1 goes to the green plant: 6 + (1 + 1)
expect(calculateMaxCitiesPowered(G, player)).to.equal(8);
player.powerPlantsNotUsed = [50];
expect(powers(G, player, 50)).to.equal(6);
});
it('leaves every other map untouched', () => {
const { G, player } = bureaucracy([wind(13, 1)], ['Zermatt']);
G.map = setup(3, { map: 'Germany', variant: 'original' }, 'g').map;
expect(alpineBonusLeft(G, player)).to.equal(0);
expect(powers(G, player, 13)).to.equal(1);
});
});
});

View file

@ -1070,7 +1070,7 @@ import { formatDuration } from '../util/time';
import { playerOrderForDisplay } from '../util/player-order';
import { freePlantMoves, canAutoFinishPowering, poweredCities } from '../util/powering';
import { bidRevision, canReopenPowering } from 'powergrid-engine/src/choice-revisions';
import { availableMoves, canStoreFuel } from 'powergrid-engine/src/available-moves';
import { alpineCitiesOwned, alpineEligible, availableMoves, canStoreFuel } from 'powergrid-engine/src/available-moves';
import { powerIncome, updatePlayerCapacity } from 'powergrid-engine/src/engine';
import { inactiveMapNetwork } from '../util/inactive-map';
import { desktopBoardLayout, PLAYER_SETTING_ROW_HEIGHT } from '../util/board-layout';
@ -1439,7 +1439,13 @@ export default class Game extends Vue {
!this.G.currentPlayers.includes(this.player)
)
return undefined;
return this.G.players[this.player]?.powerPlants.reduce((total, plant) => total + plant.citiesPowered, 0);
const player = this.G.players[this.player];
if (!player) return undefined;
return (
player.powerPlants.reduce((total, plant) => total + plant.citiesPowered, 0) +
// SwitzerlandCustom: +1 per green plant, up to the Alpine cities owned.
(this.G.map ? Math.min(alpineCitiesOwned(this.G, player), player.powerPlants.filter(alpineEligible).length) : 0)
);
}
get poweringPlayer() {
@ -2570,9 +2576,21 @@ export default class Game extends Vue {
break;
}
// Send the engine's own offer for a single-fuel plant: it can differ from the printed card
// (SwitzerlandCustom's Alpine +1 and aged cheese). Hybrids carry the mix the player picked.
const offered =
powerPlant.type == PowerPlantType.Hybrid || powerPlant.type == PowerPlantType.GarbageOilHybrid
? undefined
: this.G!.players[this.player!].availableMoves?.[MoveName.UsePowerPlant]?.find(
(m) => m.powerPlant == powerPlant.number
);
this.sendMove({
name: MoveName.UsePowerPlant,
data: { powerPlant: powerPlant.number, resourcesSpent, citiesPowered: powerPlant.citiesPowered },
data: offered ?? {
powerPlant: powerPlant.number,
resourcesSpent,
citiesPowered: powerPlant.citiesPowered,
},
});
this.disablePass = true;

View file

@ -92,7 +92,7 @@
:d="linkPath(connection)"
fill="none"
stroke-width="10"
:stroke="connection.sea ? SEA_OUTER : 'black'"
:stroke="linkOuter(connection)"
/>
<path
v-if="connection.via"
@ -100,10 +100,10 @@
:d="linkPath(connection)"
fill="none"
stroke-width="9"
:stroke="connection.sea ? SEA_INNER : 'gray'"
:stroke-dasharray="connection.sea ? SEA_DASH : undefined"
:stroke="linkInner(connection)"
:stroke-dasharray="linkDash(connection)"
/>
<!-- Sea crossings: a light blue dashed line over a dark blue edge. -->
<!-- Sea crossings: a light blue dashed line over a dark blue edge. Air links: pale dots over a dark edge. -->
<line
v-if="!connection.via"
:key="connection.nodes[0] + '_' + connection.nodes[1] + '_line1'"
@ -112,7 +112,7 @@
:x2="getX2(connection)"
:y2="getY2(connection)"
stroke-width="10"
:stroke="connection.sea ? SEA_OUTER : 'black'"
:stroke="linkOuter(connection)"
/>
<line
v-if="!connection.via"
@ -121,9 +121,21 @@
:y1="getY1(connection)"
:x2="getX2(connection)"
:y2="getY2(connection)"
stroke-width="9"
:stroke="connection.sea ? SEA_INNER : 'gray'"
:stroke-dasharray="connection.sea ? SEA_DASH : undefined"
:stroke-width="connection.rail ? 4 : 9"
:stroke="linkInner(connection)"
:stroke-dasharray="linkDash(connection)"
/>
<!-- Rail (Switzerland's Glacier Express): two red rails over a pale bed, crossed by red ties. -->
<line
v-if="!connection.via && connection.rail"
:key="connection.nodes[0] + '_' + connection.nodes[1] + '_ties'"
:x1="getX1(connection)"
:y1="getY1(connection)"
:x2="getX2(connection)"
:y2="getY2(connection)"
stroke-width="16"
:stroke="RAIL"
stroke-dasharray="3 9"
/>
</template>
<!-- Chile: connections closed until Step 3 (the gates), dashed orange over the gray line. -->
@ -243,6 +255,27 @@
</g>
</template>
<!-- SwitzerlandCustom: a snow-capped peak on each Alpine city (its owner's green plants get +1), drawn BEHIND
the city so it never covers a house, peeking over the top of the ring. -->
<template v-for="city in cities">
<g
v-if="city.alpine"
:key="city.name + '_alpine'"
pointer-events="none"
:transform="`translate(${city.x}, ${city.y - 27}) scale(1.15)`"
>
<title>{{ city.name }}: Alpine city</title>
<polygon
points="-12,9 0,-10 12,9"
fill="#6b5a4a"
stroke="white"
stroke-width="2"
stroke-linejoin="round"
/>
<polygon points="-4.6,-2.3 0,-10 4.6,-2.3 2,-4 0,-1.5 -2,-4" fill="white" />
</g>
</template>
<template v-for="city in cities">
<circle
v-if="city.connectionCost == null"
@ -797,6 +830,24 @@ export default class Map extends Vue {
readonly SEA_OUTER = '#1d4e89';
readonly SEA_INNER = '#8fd3ff';
readonly SEA_DASH = '16 9';
readonly AIR_OUTER = '#3c3c3c';
readonly AIR_INNER = '#e6e6e6';
readonly AIR_DASH = '5 9';
readonly RAIL = '#c8102e';
readonly RAIL_BED = '#f3ead6';
linkOuter(c: Connection) {
return c.sea ? this.SEA_OUTER : c.air ? this.AIR_OUTER : c.rail ? this.RAIL : 'black';
}
linkInner(c: Connection) {
return c.sea ? this.SEA_INNER : c.air ? this.AIR_INNER : c.rail ? this.RAIL_BED : 'gray';
}
linkDash(c: Connection) {
return c.sea ? this.SEA_DASH : c.air ? this.AIR_DASH : undefined;
}
// Quadratic curve from one end to the other, bending toward `via`.
linkPath(connection) {

View file

@ -0,0 +1 @@
{"name":"SwitzerlandCustom","land":["M62,950L64,938L103,825L107,813L497,219L505,209L515,201L720,112L732,108L947,69L959,67L971,69L983,73L1141,182L1151,190L1251,285L1259,295L1263,307L1386,639L1388,651L1375,793L1373,805L1369,817L1146,1167L1138,1177L1128,1185L1116,1189L1104,1191L983,1180L971,1178L98,996L86,992L76,984L68,974L64,962Z"],"context":["M-1890,-1885L3340,-1885L3340,3143L-1890,3143Z"],"cities":[["Geneva",110,950],["Nyon",149,837],["Lausanne",264,779],["Montreux",373,830],["Sion",512,922],["Zermatt",640,1023],["Yverdon",276,658],["Neuchatel",368,553],["Biel",468,476],["Bern",543,570],["Fribourg",438,650],["Thun",551,690],["Interlaken",671,698],["Grindelwald",773,761],["Basel",539,243],["Liestal",573,359],["Rheinfelden",656,266],["Aarau",691,381],["Brugg",744,154],["Baden",776,270],["Zofingen",618,476],["Zurich",965,420],["Winterthur",997,229],["Kloten",911,313],["Uster",1051,336],["Dietikon",811,385],["Wadenswil",1064,487],["Bulach",873,199],["Schaffhausen",959,115],["Frauenfeld",1117,224],["St. Gallen",1217,319],["Appenzell",1169,429],["Chur",1223,626],["Davos",1340,651],["St. Moritz",1327,793],["Lucerne",730,518],["Zug",868,490],["Schwyz",967,558],["Altdorf",1009,670],["Engelberg",889,649],["Andermatt",930,762],["Sarnen",771,631],["Airolo",879,871],["Bellinzona",1103,925],["Locarno",976,943],["Lugano",1053,1034],["Mendrisio",983,1132],["Biasca",1026,834],["Chiasso",1104,1143]]}

View file

@ -13,6 +13,7 @@ export const geographyLoaders = {
"france": () => import(/* webpackChunkName: "geography-france" */ "./assets/france.json"),
"germany": () => import(/* webpackChunkName: "geography-germany" */ "./assets/germany.json"),
"hawaii": () => import(/* webpackChunkName: "geography-hawaii" */ "./assets/hawaii.json"),
"switzerland": () => import(/* webpackChunkName: "geography-switzerland" */ "./assets/switzerland.json"),
"indian": () => import(/* webpackChunkName: "geography-indian" */ "./assets/indian.json"),
"italy": () => import(/* webpackChunkName: "geography-italy" */ "./assets/italy.json"),
"japan": () => import(/* webpackChunkName: "geography-japan" */ "./assets/japan.json"),

View file

@ -1 +1 @@
{"USA":"america","Australia":"australia","Baden-Württemberg":"badenwurttemberg","Benelux":"benelux","Brazil":"brazil","Bremen":"bremen","Central Europe":"centraleurope","Chile":"chile","China":"china","Europe":"europe","France":"france","Germany":"germany","India":"indian","Italy":"italy","Japan":"japan","Korea":"korea","Manhattan":"manhattan","Middle East":"middleeast","North America":"northamerica","Northern Europe":"northerneurope","Quebec":"quebec","Russia":"russia","South Africa":"southafrica","Spain & Portugal":"spainportugal","UK & Ireland":"ukireland","HawaiiCustom":"hawaii"}
{"USA":"america","Australia":"australia","Baden-Württemberg":"badenwurttemberg","Benelux":"benelux","Brazil":"brazil","Bremen":"bremen","Central Europe":"centraleurope","Chile":"chile","China":"china","Europe":"europe","France":"france","Germany":"germany","India":"indian","Italy":"italy","Japan":"japan","Korea":"korea","Manhattan":"manhattan","Middle East":"middleeast","North America":"northamerica","Northern Europe":"northerneurope","Quebec":"quebec","Russia":"russia","South Africa":"southafrica","Spain & Portugal":"spainportugal","UK & Ireland":"ukireland","HawaiiCustom":"hawaii","SwitzerlandCustom":"switzerland"}

View file

@ -1,5 +1,5 @@
import type { City, GameMap } from 'powergrid-engine/src/maps';
import { maps, mapsRecharged } from 'powergrid-engine/src/maps';
import { customMaps, maps, mapsRecharged } from 'powergrid-engine/src/maps';
export interface InactiveMapNetwork {
cities: City[];
@ -10,7 +10,10 @@ export interface InactiveMapNetwork {
export function inactiveMapNetwork(map?: GameMap, variant?: string): InactiveMapNetwork {
const empty = { cities: [], links: [] };
if (!map?.cities.length) return empty;
const authored = (variant === 'original' ? maps : mapsRecharged).find((m) => m.name === map.name);
// Community custom maps keep one layout for both editions.
const authored = [...(variant === 'original' ? maps : mapsRecharged), ...customMaps].find(
(m) => m.name === map.name
);
if (!authored) return empty;
const [rx, ry] = map.adjustRatio || [1, 1];
const cities = authored.cities.map((c) => ({ ...c, x: c.x * rx, y: c.y * ry }));
@ -27,7 +30,8 @@ export function inactiveMapNetwork(map?: GameMap, variant?: string): InactiveMap
return {
cities: cities.filter((c) => !active.has(c.name)),
links: authored.connections
.filter((c) => c.nodes.some((name) => !active.has(name)))
// Curved links (Hawaii's ferry, Switzerland's helicopters) would cut straight across the board here.
.filter((c) => !c.via && c.nodes.some((name) => !active.has(name)))
.map((c) => ({ from: byName.get(c.nodes[0])!, to: byName.get(c.nodes[1])! })),
};
}

View file

@ -1,20 +1,38 @@
import type { GameState, Move, Player } from 'powergrid-engine';
import { MoveName } from 'powergrid-engine';
import { move as applyMove, MoveName } from 'powergrid-engine';
import { alpineCitiesOwned, alpineEligible } from 'powergrid-engine/src/available-moves';
import { isUraniumMine, Phase } from 'powergrid-engine/src/gamestate';
/**
* Every fuel-free plant, each move taken from the engine's offer AFTER the previous one is applied: an offer can
* change once another plant fires (SwitzerlandCustom's Alpine +1 is shared out among the green plants).
*/
export function freePlantMoves(state: GameState, seat: number): Move[] {
if (state.phase !== Phase.Bureaucracy || !state.currentPlayers.includes(seat)) return [];
const player = state.players[seat];
return (player.availableMoves?.UsePowerPlant || [])
.filter((move) => move.resourcesSpent.length === 0)
.map((data) => ({ name: MoveName.UsePowerPlant, data }));
const moves: Move[] = [];
let current = state;
for (;;) {
const data = (current.players[seat].availableMoves?.UsePowerPlant || []).find(
(offer) => offer.resourcesSpent.length === 0
);
if (!data) return moves;
const action: Move = { name: MoveName.UsePowerPlant, data };
moves.push(action);
// The engine changes the state it is given: work on a copy, never the live game.
current = applyMove(JSON.parse(JSON.stringify(current)), action, seat);
if (current.phase !== Phase.Bureaucracy || !current.currentPlayers.includes(seat)) return moves;
}
}
export function poweredCities(state: GameState, player: Player): number {
// Pass resets citiesPowered; the used cards keep the result visible until the next round.
const output = player.powerPlants
.filter((plant) => !isUraniumMine(state, plant) && !player.powerPlantsNotUsed.includes(plant.number))
.reduce((total, plant) => total + plant.citiesPowered, 0);
const used = player.powerPlants.filter(
(plant) => !isUraniumMine(state, plant) && !player.powerPlantsNotUsed.includes(plant.number)
);
const output =
used.reduce((total, plant) => total + plant.citiesPowered, 0) +
// SwitzerlandCustom: +1 per green plant used, up to the Alpine cities owned.
Math.min(alpineCitiesOwned(state, player), used.filter(alpineEligible).length);
return Math.min(player.cities.length, output);
}

View file

@ -3,6 +3,7 @@ import Game from '@/components/Game.vue';
import { mount } from '@vue/test-utils';
import { expect } from 'chai';
import { Phase } from 'powergrid-engine';
import { PowerPlantType } from 'powergrid-engine/src/gamestate';
const capacity = (context: any) => (Game as any).options.computed.buildingPowerCapacity.get.call(context);
@ -26,6 +27,29 @@ describe('building power capacity', () => {
expect(capacity({ G: { ...G, phase: Phase.Bureaucracy }, player: 0 })).to.equal(undefined);
});
it('counts the Alpine +1 on SwitzerlandCustom (John, 2026-11-19: 18 + 30 + 20 with Alpine cities = 14)', () => {
const map = {
cities: [{ name: 'Grindelwald', alpine: true }, { name: 'Bern' }, { name: 'Zermatt', alpine: true }],
};
const plants = [
{ number: 18, type: PowerPlantType.Wind, citiesPowered: 2 },
{ number: 30, type: PowerPlantType.Garbage, citiesPowered: 6 },
{ number: 20, type: PowerPlantType.Coal, citiesPowered: 5 },
];
const G = {
phase: Phase.Building,
currentPlayers: [0],
map,
players: [
{ powerPlants: plants, cities: [{ name: 'Grindelwald' }, { name: 'Zermatt' }, { name: 'Bern' }] },
],
};
// two Alpine cities, one green plant: still just +1
expect(capacity({ G, player: 0 })).to.equal(14);
G.players[0].cities = [{ name: 'Bern' }];
expect(capacity({ G, player: 0 })).to.equal(13);
});
it('marks capacity, caps the track position, and restores the powering marker', async () => {
const wrapper = mount(CityCount, {
propsData: { paymentTable: Array.from({ length: 22 }, (_, i) => i * 10), powerCapacity: 12 },

View file

@ -1,12 +1,13 @@
import { expect } from 'chai';
import { setup } from 'powergrid-engine';
import { maps, mapsRecharged } from 'powergrid-engine/src/maps';
import { customMaps, maps, mapsRecharged } from 'powergrid-engine/src/maps';
import { inactiveMapNetwork } from '../../src/util/inactive-map';
describe('unselected map regions', () => {
it('restores only missing authored spaces, without changing playable cities or legal moves', () => {
for (const variant of ['original', 'recharged'] as const) {
for (const authored of variant === 'original' ? maps : mapsRecharged) {
// Community custom maps (HawaiiCustom, SwitzerlandCustom) play one layout in both editions.
for (const authored of [...(variant === 'original' ? maps : mapsRecharged), ...customMaps]) {
for (const count of [2, 3, 4, 5, 6]) {
const state = setup(count, { map: authored.name as any, variant }, 'context-regions');
const before = JSON.stringify(state);

View file

@ -87,3 +87,37 @@ describe('automatic free plants', () => {
expect(canAutoFinishPowering(state, 0)).to.equal(false);
});
});
describe('powering on SwitzerlandCustom', () => {
function swiss(alpine: string[], plants: number[]) {
const state = setup(3, { map: 'SwitzerlandCustom', variant: 'original' }, 'swiss-powering');
state.phase = Phase.Bureaucracy;
state.currentPlayers = [0, 1, 2];
const player = state.players[0];
player.powerPlants = plants.map((number) => ({ ...powerPlants.find((plant) => plant.number === number)! }));
player.powerPlantsNotUsed = [...plants];
const flat = state.map.cities
.filter((c) => !c.alpine)
.slice(0, 8)
.map((c) => c.name);
player.cities = [...alpine, ...flat].map((name) => ({ name, position: 0 }));
player.passed = false;
player.availableMoves = availableMoves(state, player);
return state;
}
it('fires both green plants with ONE Alpine city: the +1 goes to one, and every move is legal', () => {
// the Alpine city must be in play for this deal
const state = swiss([], [13, 27]);
const alpine = state.map.cities.find((c) => c.alpine)!.name;
const fresh = swiss([alpine], [13, 27]);
const before = JSON.stringify(fresh);
const moves = freePlantMoves(fresh, 0);
expect(JSON.stringify(fresh), 'never changes the live game').to.equal(before);
expect(moves.length).to.equal(2);
const after = moves.reduce((current, action) => move(current, action, 0), fresh);
// 1 + 3 printed, plus one Alpine +1
expect(after.players[0].citiesPowered).to.equal(5);
expect(poweredCities(after, after.players[0])).to.equal(5);
});
});