diff --git a/CHANGELOG.md b/CHANGELOG.md index c29e40d..134efb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] - Cities of one country on one piece of land can be joined by fiber over land, even where there is no road: Pevek to Anadyr or Moscow, Juneau to Seattle, Nuuk to Sisimiut. Inside one country, crossing from Europe into Asia (Moscow–Vladivostok, Istanbul–Ankara) is no longer priced as a crossing between continents. -- No circuit of any kind can be built between North and South Korea. +- No circuit of any kind can be built between North and South Korea, and nothing leaves South Korea over land: every way out is a subsea cable. - The map zooms in twice as far, for crowded regions like New England or around Washington. - Cable ships at anchor sit a little further out from their port, and a tap on a city picks the city even with a ship close by. diff --git a/src/game/70-rules/10-helpers.js b/src/game/70-rules/10-helpers.js index a786321..2b1f47f 100644 --- a/src/game/70-rules/10-helpers.js +++ b/src/game/70-rules/10-helpers.js @@ -30,7 +30,9 @@ const lands=C=>C.land2?[C.land,C.land2]:[C.land]; // On one landmass, so fiber can go overland: the same landmass, or two cities of one country on the land a no-road // landmass is really part of (Pevek and Moscow, Juneau and Seattle, Nuuk and Sisimiut). const LAND_ON=Object.fromEntries(LANDS_LL.filter(l=>l.on).map(l=>[l.id,l.on])),landOf=x=>LAND_ON[x]||x; -const overland=(A,B)=>{const P=lands(A),Q=lands(B);return P.some(x=>Q.includes(x))||A.cc===B.cc&&P.some(x=>Q.some(y=>landOf(x)===landOf(y)));}; +// South Korea's only land border is the DMZ: everything out of the country goes by sea. +const SEALED=['KR']; +const overland=(A,B)=>{if(A.cc!==B.cc&&(SEALED.includes(A.cc)||SEALED.includes(B.cc)))return false;const P=lands(A),Q=lands(B);return P.some(x=>Q.includes(x))||A.cc===B.cc&&P.some(x=>Q.some(y=>landOf(x)===landOf(y)));}; const isSub=(a,b)=>!overland(CITY[a],CITY[b]); const popUp=c=>S.pops[c]&&!(S.pops[c].down>S.day); const regionsCount=()=>new Set(Object.keys(S.pops).map(c=>CITY[c].reg)).size; diff --git a/tests/borders-overland.test.js b/tests/borders-overland.test.js index ef6a7ce..d8b740f 100644 --- a/tests/borders-overland.test.js +++ b/tests/borders-overland.test.js @@ -49,3 +49,15 @@ test('no circuit of any kind between North and South Korea, and still none betwe assert.ok(ev("latFloor('icn','fnj')") > ev("latMaxOf('icn','fnj')")); assert.deepEqual(errors, []); }); + +test('nothing leaves South Korea over land: every way out is a subsea cable', () => { + const { ev, errors } = load(); + ev(start); + for (const c of ['pek', 'sha', 'vvo', 'fnj']) assert.equal(ev(`isSub('icn','${c}')`), true, `Seoul–${c}: by sea only`); + assert.equal(ev("CITIES.filter(c=>c.cc!=='KR'&&!isSub('icn',c.id)).length"), 0, 'no city anywhere is overland from Seoul'); + assert.equal(ev("dfAllowed('icn','pek')"), false, 'no terrestrial dark fiber to Beijing'); + assert.equal(ev("isSub('pek','fnj')"), false, 'the rest of the peninsula still borders China'); + ev("UI.via=null;UI.lmode='wave';openLinkModal('icn','tok')"); + assert.match(ev("document.getElementById('modalCard').textContent"), /Subsea/); + assert.deepEqual(errors, []); +});