China: correct seven city names and the Changchun-Jilin cost (#59) (#117)

yvessl reported in September 2023 that the China map does not match the printed
board. Every item still held; nothing had been applied.

Names (enum values, so the strings players actually see):
  Qiqhaer  -> Qiqha'er     Qingoad  -> Qingdao
  Badtou   -> Baotou       Kuerle   -> Ku'erle
  Xian     -> Xi'an        Chiyang  -> Guiyang
  Yinchjan -> Yinchuan

Four of these were plain transcription errors (Qingoad/Badtou/Chiyang/Yinchjan);
the other three were missing apostrophes. Enum KEYS were renamed only where the
key itself was misspelled -- Qiqhaer/Kuerle/Xian keep their identifier-safe keys
and carry the apostrophe in the value.

Connection: Changchun-Jilin was cost 5, the board says 2.

Also: engine/.eslintrc.js `quotes` gains `avoidEscape: true`. Three of the new
names contain an apostrophe, and without that option the rule and Prettier
deadlock -- Prettier rewrites 'Xi\'an' to "Xi'an" to minimise escapes, and the
rule then errors on exactly what Prettier produced. avoidEscape is the standard
companion setting; engine-wide lint is unchanged at 0 errors / 30 warnings.

Tests: 72 specs (+3). China had no coverage at all before this. The two
regression specs are teeth-checked against the pre-change map (they fail with
"Qiqha'er is on the map" and "expected 5 to equal 2"); they assert on the map
module rather than through setup(), because setup() trims cities by player count
and would quietly stop covering whichever names fell out of play. The third spec
walks every connection endpoint against the city list, so a rename that missed a
reference fails loudly.

DEPLOY NOTE -- this is the replay-breaking class, not an inert one, though the
blast radius is small and recoverable. Live game state stores its own map, so a
China game already in progress keeps playing on the old names. What breaks is
the replay view: wrapper.replay() rebuilds from a fresh setup() and re-applies
logged moves, so a logged Build on "Qingoad" no longer matches a map that says
"Qingdao". Measured against a real 6P China game -- it throws
"Wrong argument for the command Build", i.e. it fails loudly rather than
diverging silently. The player-facing path (GET /gameplay/:id/log?end=N) is
read-only, so a player who hits it can refresh and carry on; the variant that
persists (POST /gameplay/:id/replay) is admin-only. At time of writing exactly
one live China game exists.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
goldjohn6 2026-08-14 09:26:23 -07:00 • committed by GitHub
commit 6fb432a041
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 74 additions and 28 deletions

View file

@ -29,6 +29,10 @@ module.exports = {
'no-return-assign': 'off',
// 'no-fallthrough': 'off',
'no-empty': 'off',
quotes: ['error', 'single'],
// avoidEscape lets a string that itself contains an apostrophe use double
// quotes ("Xi'an") instead of escaping ('Xi\'an'). Without it this rule and
// Prettier deadlock: Prettier rewrites the escaped form to double quotes to
// minimise escapes, and the rule then rejects what Prettier just produced.
quotes: ['error', 'single', { avoidEscape: true }],
},
};

View file

@ -29,6 +29,7 @@ import {
sellUraniumMine,
Variant,
} from './gamestate';
import { Cities as ChinaCities, map as chinaMap } from './maps/china';
import { Move, MoveName } from './move';
import { powerPlants } from './powerPlants';
@ -1839,4 +1840,45 @@ describe('Engine', () => {
expect(G.currentPlayers, 'the dropped player is no longer on the clock').to.not.include(dropped);
expect(G.players[dropped].isDropped).to.be.true;
});
it('should spell the China cities as the printed board does', () => {
// Issue #59: seven names were transcribed wrong. Asserted on the map module
// rather than through setup(), because setup() trims cities by player count
// and would quietly stop covering whichever names fell out of play.
const names = chinaMap.cities.map((c) => c.name);
for (const name of ["Qiqha'er", 'Qingdao', 'Baotou', "Ku'erle", "Xi'an", 'Guiyang', 'Yinchuan']) {
expect(names, `${name} is on the map`).to.include(name);
}
for (const typo of ['Qiqhaer', 'Qingoad', 'Badtou', 'Kuerle', 'Xian', 'Chiyang', 'Yinchjan']) {
expect(names, `the old spelling ${typo} is gone`).to.not.include(typo);
}
});
it('should price the China Changchun–Jilin connection at 2', () => {
// Issue #59: the file said 5; the printed board says 2.
const link = chinaMap.connections.find(
(c) => c.nodes.includes(ChinaCities.Changchun) && c.nodes.includes(ChinaCities.Jilin)
);
expect(link, 'Changchun–Jilin is connected').to.not.be.undefined;
expect(link!.cost).to.equal(2);
});
it('should still set up a full China game after the renames', () => {
// A rename that missed a reference would leave a connection pointing at a city
// that no longer exists; region graph and setup both walk that list.
const G = setup(6, { map: 'China', variant: 'recharged' }, 'china-rename-smoke');
expect(G.map.name).to.equal('China');
expect(G.players).to.have.length(6);
const cityNames = G.map.cities.map((c) => c.name);
for (const connection of G.map.connections) {
for (const node of connection.nodes) {
expect(cityNames, `connection endpoint ${node} exists`).to.include(node);
}
}
});
});

View file

@ -15,7 +15,7 @@ export enum Regions {
export enum Cities {
Hegang = 'Hegang',
Qiqhaer = 'Qiqhaer',
Qiqhaer = "Qiqha'er",
Haerbin = 'Haerbin',
Jilin = 'Jilin',
Fushun = 'Fushun',
@ -24,7 +24,7 @@ export enum Cities {
Shanghai = 'Shanghai',
Hangzhou = 'Hangzhou',
Nanjing = 'Nanjing',
Qingoad = 'Qingoad',
Qingdao = 'Qingdao',
Jinan = 'Jinan',
Zhengzhou = 'Zhengzhou',
Shijiazhuang = 'Shijiazhuang',
@ -34,7 +34,7 @@ export enum Cities {
Tianjin = 'Tianjin',
Beijing = 'Beijing',
Taiyuan = 'Taiyuan',
Badtou = 'Badtou',
Baotou = 'Baotou',
Fuzhou = 'Fuzhou',
Nanchang = 'Nanchang',
Chaozhou = 'Chaozhou',
@ -45,17 +45,17 @@ export enum Cities {
Hami = 'Hami',
Karamay = 'Karamay',
Wulumuqi = 'Wulumuqi',
Kuerle = 'Kuerle',
Yinchjan = 'Yinchjan',
Kuerle = "Ku'erle",
Yinchuan = 'Yinchuan',
Xining = 'Xining',
Lanzhou = 'Lanzhou',
Kunming = 'Kunming',
Chengou = 'Chengou',
Xian = 'Xian',
Xian = "Xi'an",
Chongqing = 'Chongqing',
Nanning = 'Nanning',
Haikou = 'Haikou',
Chiyang = 'Chiyang',
Guiyang = 'Guiyang',
}
export const map: GameMap = {
@ -71,7 +71,7 @@ export const map: GameMap = {
{ name: Cities.Shanghai, region: Regions.Green, x: 3462, y: 1672 },
{ name: Cities.Hangzhou, region: Regions.Green, x: 3280, y: 1824 },
{ name: Cities.Nanjing, region: Regions.Green, x: 3130, y: 1632 },
{ name: Cities.Qingoad, region: Regions.Green, x: 3322, y: 1316 },
{ name: Cities.Qingdao, region: Regions.Green, x: 3322, y: 1316 },
{ name: Cities.Jinan, region: Regions.Green, x: 3002, y: 1292 },
{ name: Cities.Zhengzhou, region: Regions.Green, x: 2778, y: 1438 },
{ name: Cities.Shijiazhuang, region: Regions.Green, x: 2866, y: 1152 },
@ -81,7 +81,7 @@ export const map: GameMap = {
{ name: Cities.Tianjin, region: Regions.Red, x: 3134, y: 1016 },
{ name: Cities.Beijing, region: Regions.Red, x: 2886, y: 910 },
{ name: Cities.Taiyuan, region: Regions.Red, x: 2588, y: 1130 },
{ name: Cities.Badtou, region: Regions.Red, x: 2500, y: 862 },
{ name: Cities.Baotou, region: Regions.Red, x: 2500, y: 862 },
{ name: Cities.Fuzhou, region: Regions.Brown, x: 3290, y: 2132 },
{ name: Cities.Nanchang, region: Regions.Brown, x: 3004, y: 1974 },
{ name: Cities.Chaozhou, region: Regions.Brown, x: 3096, y: 2322 },
@ -93,7 +93,7 @@ export const map: GameMap = {
{ name: Cities.Karamay, region: Regions.Purple, x: 1304, y: 372 },
{ name: Cities.Wulumuqi, region: Regions.Purple, x: 1520, y: 558 },
{ name: Cities.Kuerle, region: Regions.Purple, x: 1326, y: 756 },
{ name: Cities.Yinchjan, region: Regions.Purple, x: 2208, y: 1058 },
{ name: Cities.Yinchuan, region: Regions.Purple, x: 2208, y: 1058 },
{ name: Cities.Xining, region: Regions.Purple, x: 1868, y: 1226 },
{ name: Cities.Lanzhou, region: Regions.Purple, x: 2142, y: 1328 },
{ name: Cities.Kunming, region: Regions.Yellow, x: 1840, y: 2248 },
@ -102,7 +102,7 @@ export const map: GameMap = {
{ name: Cities.Chongqing, region: Regions.Yellow, x: 2300, y: 1880 },
{ name: Cities.Nanning, region: Regions.Yellow, x: 2318, y: 2452 },
{ name: Cities.Haikou, region: Regions.Yellow, x: 2524, y: 2680 },
{ name: Cities.Chiyang, region: Regions.Yellow, x: 2212, y: 2112 },
{ name: Cities.Guiyang, region: Regions.Yellow, x: 2212, y: 2112 },
],
connections: [
{ nodes: [Cities.Kunming, Cities.Chengou], cost: 16 },
@ -114,17 +114,17 @@ export const map: GameMap = {
{ nodes: [Cities.Nanning, Cities.Guangzhou], cost: 11 },
{ nodes: [Cities.Xining, Cities.Chengou], cost: 20 },
{ nodes: [Cities.Chengou, Cities.Chongqing], cost: 6 },
{ nodes: [Cities.Chongqing, Cities.Chiyang], cost: 9 },
{ nodes: [Cities.Chiyang, Cities.Kunming], cost: 12 },
{ nodes: [Cities.Chiyang, Cities.Nanning], cost: 12 },
{ nodes: [Cities.Chiyang, Cities.Guangzhou], cost: 18 },
{ nodes: [Cities.Chongqing, Cities.Guiyang], cost: 9 },
{ nodes: [Cities.Guiyang, Cities.Kunming], cost: 12 },
{ nodes: [Cities.Guiyang, Cities.Nanning], cost: 12 },
{ nodes: [Cities.Guiyang, Cities.Guangzhou], cost: 18 },
{ nodes: [Cities.Guangzhou, Cities.Changsha], cost: 14 },
{ nodes: [Cities.Changsha, Cities.Chongqing], cost: 16 },
{ nodes: [Cities.Changsha, Cities.Wuhan], cost: 6 },
{ nodes: [Cities.Wuhan, Cities.Nanchang], cost: 6 },
{ nodes: [Cities.Nanchang, Cities.Changsha], cost: 7 },
{ nodes: [Cities.Changsha, Cities.Chiyang], cost: 15 },
{ nodes: [Cities.Chiyang, Cities.Chengou], cost: 13 },
{ nodes: [Cities.Changsha, Cities.Guiyang], cost: 15 },
{ nodes: [Cities.Guiyang, Cities.Chengou], cost: 13 },
{ nodes: [Cities.Guangzhou, Cities.Nanchang], cost: 16 },
{ nodes: [Cities.Nanchang, Cities.Chaozhou], cost: 14 },
{ nodes: [Cities.Chaozhou, Cities.Fuzhou], cost: 9 },
@ -143,8 +143,8 @@ export const map: GameMap = {
{ nodes: [Cities.Wuhan, Cities.Zhengzhou], cost: 10 },
{ nodes: [Cities.Zhengzhou, Cities.Xian], cost: 10 },
{ nodes: [Cities.Xian, Cities.Lanzhou], cost: 15 },
{ nodes: [Cities.Lanzhou, Cities.Yinchjan], cost: 9 },
{ nodes: [Cities.Yinchjan, Cities.Xining], cost: 11 },
{ nodes: [Cities.Lanzhou, Cities.Yinchuan], cost: 9 },
{ nodes: [Cities.Yinchuan, Cities.Xining], cost: 11 },
{ nodes: [Cities.Lanzhou, Cities.Taiyuan], cost: 18 },
{ nodes: [Cities.Taiyuan, Cities.Xian], cost: 12 },
{ nodes: [Cities.Taiyuan, Cities.Zhengzhou], cost: 11 },
@ -156,14 +156,14 @@ export const map: GameMap = {
{ nodes: [Cities.Zhengzhou, Cities.Nanjing], cost: 12 },
{ nodes: [Cities.Nanjing, Cities.Wuhan], cost: 10 },
{ nodes: [Cities.Jinan, Cities.Nanjing], cost: 11 },
{ nodes: [Cities.Nanjing, Cities.Qingoad], cost: 12 },
{ nodes: [Cities.Qingoad, Cities.Jinan], cost: 6 },
{ nodes: [Cities.Nanjing, Cities.Qingdao], cost: 12 },
{ nodes: [Cities.Qingdao, Cities.Jinan], cost: 6 },
{ nodes: [Cities.Jinan, Cities.Tianjin], cost: 6 },
{ nodes: [Cities.Xining, Cities.Lanzhou], cost: 6 },
{ nodes: [Cities.Yinchjan, Cities.Badtou], cost: 9 },
{ nodes: [Cities.Badtou, Cities.Taiyuan], cost: 9 },
{ nodes: [Cities.Taiyuan, Cities.Yinchjan], cost: 14 },
{ nodes: [Cities.Yinchjan, Cities.Hami], cost: 25 },
{ nodes: [Cities.Yinchuan, Cities.Baotou], cost: 9 },
{ nodes: [Cities.Baotou, Cities.Taiyuan], cost: 9 },
{ nodes: [Cities.Taiyuan, Cities.Yinchuan], cost: 14 },
{ nodes: [Cities.Yinchuan, Cities.Hami], cost: 25 },
{ nodes: [Cities.Hami, Cities.Xining], cost: 25 },
{ nodes: [Cities.Wulumuqi, Cities.Kuerle], cost: 9 },
{ nodes: [Cities.Kuerle, Cities.Karamay], cost: 12 },
@ -174,13 +174,13 @@ export const map: GameMap = {
{ nodes: [Cities.Beijing, Cities.Shijiazhuang], cost: 6 },
{ nodes: [Cities.Beijing, Cities.Tangshan], cost: 3 },
{ nodes: [Cities.Tangshan, Cities.Tianjin], cost: 0 },
{ nodes: [Cities.Beijing, Cities.Badtou], cost: 14 },
{ nodes: [Cities.Beijing, Cities.Baotou], cost: 14 },
{ nodes: [Cities.Tangshan, Cities.Shenyang], cost: 11 },
{ nodes: [Cities.Dalian, Cities.Anshan], cost: 6 },
{ nodes: [Cities.Qiqhaer, Cities.Hegang], cost: 11 },
{ nodes: [Cities.Hegang, Cities.Haerbin], cost: 7 },
{ nodes: [Cities.Haerbin, Cities.Qiqhaer], cost: 6 },
{ nodes: [Cities.Changchun, Cities.Jilin], cost: 5 },
{ nodes: [Cities.Changchun, Cities.Jilin], cost: 2 },
{ nodes: [Cities.Jilin, Cities.Haerbin], cost: 5 },
{ nodes: [Cities.Haerbin, Cities.Changchun], cost: 5 },
{ nodes: [Cities.Changchun, Cities.Shenyang], cost: 5 },