Pie in the Sky, the early game: a pace forecast on the Launch tab, patchy-sky customers before 40%, a hint to wait on dishes
- Launch tab: each crust being filled says when it is full at today's pace (piePace: the pads that reach it, one launch per leadDays(gap) each with the rocket last queued or the fastest available, capped by the factory with the shelf and the queue as a buffer). Past two years and pad-bound, one nudge for another pad at the coastal POP nearest the equator, with a build button (piePadTip). - Patchy-sky customers (60-features/99-pie-patchy.js): a revenue line in pieMoney, no flows, so routing is unchanged and games without a rocket company never see it. Up to $30M/mo for Shortcrust (scaled by crust size), ramping from 10% to 40% coverage with one working dish under the crust, then times (1 - pieCarry) so it hands over to regular orbit customers by 60%. Shown on the Traffic tab; booked in S.pie.book like all orbit income. - Dishes tab: under 30% coverage, a gentle note that dishes earn nothing yet and cost money every month. - Payback on the O7 run is unchanged at one decimal (seed 7: 7.2 years, seed 11: 8.2).
This commit is contained in:
parent
267f9efc72
commit
7001174d79
15 changed files with 272 additions and 5 deletions
|
|
@ -20,6 +20,10 @@ All notable changes to this project are documented here. The project follows
|
|||
- A bad week in orbit now hurts without emptying the sky: a half-baked crust carries part of its traffic from 40% (all of it from 60%) instead of nothing until 60%, satellites wear out a few at a time near the end of their life instead of a whole launch month on one day, no storm or food fight takes more than a tenth of a crust, and orbit customers put up with about a month without service before they cancel.
|
||||
- A full satellite constellation now pays for itself in about seven years if you run it well, instead of practically never: pies cost half as much to build, landing rights cost less (at most $100M a year a country), orbit customers pay about a quarter more, the sky sells 40% of a crust's capacity instead of 25%, and orbit customers call twice as often. Terminal customers also land on the nearest pie dish with room for all of their traffic, instead of squeezing into a nearly full one.
|
||||
- Governments now pay for space too, in a new Gov tab in Pie Control. The Rural Digital Pie Fund auctions support for remote towns only your satellites reach: ask less than the rival and you are paid every month for five years, as long as the town stays well served after a three-month deadline, or the award is taken away and half of it paid back. The Ex-Im Pie Bank lends a rocket company a lot of money at under 3%, if you launch the pies you promised by a deadline and keep a pie dish in its country; break that and the rate goes up and its government picks a fight. And the UK now pays a smaller grant for Pitcairn when the islanders are online through your satellites.
|
||||
- Pie Control's Launch tab now says how long each crust you are filling takes to fill at your current pace. When that is more than two years, it suggests another launch pad at your coastal POP nearest the equator, with a button to build it.
|
||||
- Buoys, ships' mail and sensors that can live with gaps in the sky now pay a little before a crust carries anything: from 10% coverage, up to about $30M a month for the Shortcrust at 40%, as long as one pie dish works under it. Between 40% and 60% they make way for regular orbit customers, and the Traffic tab lists them.
|
||||
- While your crusts are under 30% covered, the Dishes tab reminds you that pie dishes earn nothing until the sky fills up, so it pays to wait.
|
||||
|
||||
- Your own subsea cables now land right on the city's dot, also in Fujairah, Dubai, Karachi, Barcelona, Osaka and other cities the map shifts slightly so they do not overlap (#305).
|
||||
- Starting a new network no longer leaves the last one's "New POP!" and money pop-ups frozen all over the map until a reload.
|
||||
|
||||
|
|
|
|||
|
|
@ -3413,6 +3413,7 @@
|
|||
"pie.cr_upper":"Oberkruste (1.100 km)",
|
||||
"pie.crust_line":"{alt} km · {n} von {full} Pies · {q} unterwegs · {p} abgedeckt",
|
||||
"pie.dish_note":"Eine Pie-Schüssel spricht mit den Pies über ihr. Sie braucht einen POP in ihrer Stadt und Landerechte in ihrem Land.",
|
||||
"pie.dish_wait":"Schüsseln verdienen nichts, bis eine Kruste zu {min} abgedeckt ist, und deine vollste steht bei {p}. Jede kostet {mo} im Monat, Warten lohnt sich also. Nur Bojen, Schiffe und Sensoren zahlen früher, ab {lo}, und ihnen reicht eine Schüssel.",
|
||||
"pie.earned":"Aus dem Orbit verdient",
|
||||
"pie.earned_mo":"Der Orbit bringt {amt}/Monat · {n} Schüsseln abseits vom Backbone tragen keinen Transit",
|
||||
"pie.factory":"Pie-Fabrik",
|
||||
|
|
@ -3454,6 +3455,10 @@
|
|||
"pie.no_pads":"Noch keine Startrampen. Eine Rampe braucht einen POP in einer Stadt an der Küste.",
|
||||
"pie.no_rights":"keine Landerechte",
|
||||
"pie.open_pie_control":"Pie Control",
|
||||
"pie.pace_months":{"one":"In diesem Tempo ({mo} Pies im Monat) ist diese Kruste in etwa {n} Monat voll.","other":"In diesem Tempo ({mo} Pies im Monat) ist diese Kruste in etwa {n} Monaten voll."},
|
||||
"pie.pace_pad":"Eine weitere Startrampe füllt sie schneller. Dein Küsten-POP am nächsten am Äquator ist {city}, dort kostet ein Start {p} weniger.",
|
||||
"pie.pace_pad_none":"Eine weitere Startrampe füllt sie schneller: Eröffne einen POP an einer Küste, am besten nahe am Äquator, wo Starts weniger kosten.",
|
||||
"pie.pace_years":{"one":"In diesem Tempo ({mo} Pies im Monat) ist diese Kruste in etwa {n} Jahr voll.","other":"In diesem Tempo ({mo} Pies im Monat) ist diese Kruste in etwa {n} Jahren voll."},
|
||||
"pie.pad_busy":"belegt bis {d}",
|
||||
"pie.pad_free":"bereit",
|
||||
"pie.pads":"Startrampen",
|
||||
|
|
@ -3694,6 +3699,8 @@
|
|||
"pie_traffic.no_landing":"{city} · keine Schüssel kann es landen",
|
||||
"pie_traffic.orbit_no_fiber":"Orbit {o} ms, kein Glasfaserweg",
|
||||
"pie_traffic.orbit_vs_fiber":"Orbit {o} ms statt Glasfaser {f} ms",
|
||||
"pie_traffic.patchy":"Kunden mit Lückenhimmel",
|
||||
"pie_traffic.patchy_hint":"Bojen, Schiffspost und Sensoren, die auf den nächsten Pie warten können. Sie zahlen ab {lo} Abdeckung und gehen zwischen {min} und {max} an die normalen Orbit-Kunden über.",
|
||||
"pie_traffic.riding":"Wer mitfliegt",
|
||||
"pie_traffic.route_ab":"{a} → {b}",
|
||||
"pie_traffic.tab":"Traffic",
|
||||
|
|
|
|||
|
|
@ -3411,6 +3411,7 @@
|
|||
"pie.cr_upper":"Corteza de arriba (1.100 km)",
|
||||
"pie.crust_line":"{alt} km · {n} de {full} tartas · {q} en camino · {p} de cobertura",
|
||||
"pie.dish_note":"Una antena-tarta habla con las tartas que pasan por encima. Necesita un POP en su ciudad y derechos de aterrizaje en su país.",
|
||||
"pie.dish_wait":"Las antenas no ganan nada hasta que una corteza tenga {min} de cobertura, y la tuya más llena está en {p}. Cada una cuesta {mo} al mes, así que compensa esperar. Solo boyas, barcos y sensores pagan antes, desde {lo}, y les basta una antena.",
|
||||
"pie.earned":"Ganado desde la órbita",
|
||||
"pie.earned_mo":"La órbita gana {amt}/mes · {n} antenas fuera del backbone no llevan tránsito",
|
||||
"pie.factory":"Fábrica de tartas",
|
||||
|
|
@ -3452,6 +3453,10 @@
|
|||
"pie.no_pads":"Aún no hay plataformas de lanzamiento. Una plataforma necesita un POP en una ciudad costera.",
|
||||
"pie.no_rights":"sin derechos de aterrizaje",
|
||||
"pie.open_pie_control":"Pie Control",
|
||||
"pie.pace_months":{"one":"A este ritmo ({mo} tartas al mes), esta corteza estará llena en {n} mes, más o menos.","other":"A este ritmo ({mo} tartas al mes), esta corteza estará llena en unos {n} meses."},
|
||||
"pie.pace_pad":"Otra plataforma la llenaría más rápido. Tu POP costero más cerca del ecuador es {city}, donde un lanzamiento cuesta {p} menos.",
|
||||
"pie.pace_pad_none":"Otra plataforma la llenaría más rápido: abre un POP en la costa, mejor cerca del ecuador, donde los lanzamientos cuestan menos.",
|
||||
"pie.pace_years":{"one":"A este ritmo ({mo} tartas al mes), esta corteza estará llena en {n} año, más o menos.","other":"A este ritmo ({mo} tartas al mes), esta corteza estará llena en unos {n} años."},
|
||||
"pie.pad_busy":"ocupada hasta el {d}",
|
||||
"pie.pad_free":"lista",
|
||||
"pie.pads":"Plataformas de lanzamiento",
|
||||
|
|
@ -3692,6 +3697,8 @@
|
|||
"pie_traffic.no_landing":"{city} · ninguna antena puede aterrizarlo",
|
||||
"pie_traffic.orbit_no_fiber":"órbita {o} ms, sin camino por fibra",
|
||||
"pie_traffic.orbit_vs_fiber":"órbita {o} ms frente a fibra {f} ms",
|
||||
"pie_traffic.patchy":"Clientes de cielo a ratos",
|
||||
"pie_traffic.patchy_hint":"Boyas, correo de barcos y sensores que pueden esperar a la próxima tarta. Pagan desde {lo} de cobertura y pasan a los clientes orbitales normales entre {min} y {max}.",
|
||||
"pie_traffic.riding":"Quién viaja",
|
||||
"pie_traffic.route_ab":"{a} → {b}",
|
||||
"pie_traffic.tab":"Tráfico",
|
||||
|
|
|
|||
|
|
@ -3411,6 +3411,7 @@
|
|||
"pie.cr_upper":"Croûte du dessus (1 100 km)",
|
||||
"pie.crust_line":"{alt} km · {n} sur {full} tartes · {q} en route · {p} couvert",
|
||||
"pie.dish_note":"Une antenne-tarte parle aux tartes au-dessus d'elle. Il lui faut un POP dans sa ville et des droits d'atterrissage dans son pays.",
|
||||
"pie.dish_wait":"Les antennes ne rapportent rien tant qu'une croûte n'est pas couverte à {min}, et ta plus remplie est à {p}. Chacune coûte {mo} par mois, alors mieux vaut attendre. Seuls les bouées, les navires et les capteurs paient plus tôt, dès {lo}, et une antenne leur suffit.",
|
||||
"pie.earned":"Gagné depuis l'orbite",
|
||||
"pie.earned_mo":"L'orbite rapporte {amt}/mois · {n} paraboles hors du backbone ne portent aucun transit",
|
||||
"pie.factory":"Usine à tartes",
|
||||
|
|
@ -3452,6 +3453,10 @@
|
|||
"pie.no_pads":"Pas encore de pas de tir. Il faut un POP dans une ville côtière.",
|
||||
"pie.no_rights":"pas de droits d'atterrissage",
|
||||
"pie.open_pie_control":"Pie Control",
|
||||
"pie.pace_months":{"one":"À ce rythme ({mo} tartes par mois), cette croûte sera pleine dans environ {n} mois.","other":"À ce rythme ({mo} tartes par mois), cette croûte sera pleine dans environ {n} mois."},
|
||||
"pie.pace_pad":"Un pas de tir de plus la remplirait plus vite. Ton POP côtier le plus proche de l'équateur est {city}, où un lancement coûte {p} de moins.",
|
||||
"pie.pace_pad_none":"Un pas de tir de plus la remplirait plus vite : ouvre un POP sur une côte, idéalement près de l'équateur, où les lancements coûtent moins.",
|
||||
"pie.pace_years":{"one":"À ce rythme ({mo} tartes par mois), cette croûte sera pleine dans environ {n} an.","other":"À ce rythme ({mo} tartes par mois), cette croûte sera pleine dans environ {n} ans."},
|
||||
"pie.pad_busy":"occupé jusqu'au {d}",
|
||||
"pie.pad_free":"prêt",
|
||||
"pie.pads":"Pas de tir",
|
||||
|
|
@ -3692,6 +3697,8 @@
|
|||
"pie_traffic.no_landing":"{city} · aucune antenne ne peut l’atterrir",
|
||||
"pie_traffic.orbit_no_fiber":"orbite {o} ms, pas de chemin en fibre",
|
||||
"pie_traffic.orbit_vs_fiber":"orbite {o} ms contre fibre {f} ms",
|
||||
"pie_traffic.patchy":"Clients du ciel à trous",
|
||||
"pie_traffic.patchy_hint":"Bouées, courrier de bord et capteurs qui peuvent attendre la prochaine tarte. Ils paient dès {lo} de couverture et passent le relais aux clients orbitaux habituels entre {min} et {max}.",
|
||||
"pie_traffic.riding":"Qui est à bord",
|
||||
"pie_traffic.route_ab":"{a} → {b}",
|
||||
"pie_traffic.tab":"Trafic",
|
||||
|
|
|
|||
|
|
@ -3411,6 +3411,7 @@
|
|||
"pie.cr_upper":"Crosta di sopra (1.100 km)",
|
||||
"pie.crust_line":"{alt} km · {n} di {full} torte · {q} in arrivo · {p} di copertura",
|
||||
"pie.dish_note":"Una parabola-torta parla con le torte sopra di lei. Le serve un POP nella sua città e i diritti di atterraggio nel suo paese.",
|
||||
"pie.dish_wait":"Le parabole non guadagnano nulla finché una crosta non ha il {min} di copertura, e la tua più piena è al {p}. Ognuna costa {mo} al mese, quindi conviene aspettare. Solo boe, navi e sensori pagano prima, dal {lo}, e a loro basta una parabola.",
|
||||
"pie.earned":"Guadagnato dall'orbita",
|
||||
"pie.earned_mo":"L'orbita rende {amt}/mese · {n} parabole fuori dal backbone non portano transito",
|
||||
"pie.factory":"Fabbrica di torte",
|
||||
|
|
@ -3452,6 +3453,10 @@
|
|||
"pie.no_pads":"Ancora nessuna rampa di lancio. Una rampa richiede un POP in una città sulla costa.",
|
||||
"pie.no_rights":"senza diritti di atterraggio",
|
||||
"pie.open_pie_control":"Pie Control",
|
||||
"pie.pace_months":{"one":"A questo ritmo ({mo} torte al mese), questa crosta è piena tra circa {n} mese.","other":"A questo ritmo ({mo} torte al mese), questa crosta è piena tra circa {n} mesi."},
|
||||
"pie.pace_pad":"Un'altra rampa la riempirebbe più in fretta. Il tuo POP costiero più vicino all'equatore è {city}, dove un lancio costa il {p} in meno.",
|
||||
"pie.pace_pad_none":"Un'altra rampa la riempirebbe più in fretta: apri un POP sulla costa, meglio se vicino all'equatore, dove i lanci costano meno.",
|
||||
"pie.pace_years":{"one":"A questo ritmo ({mo} torte al mese), questa crosta è piena tra circa {n} anno.","other":"A questo ritmo ({mo} torte al mese), questa crosta è piena tra circa {n} anni."},
|
||||
"pie.pad_busy":"occupata fino al {d}",
|
||||
"pie.pad_free":"pronta",
|
||||
"pie.pads":"Rampe di lancio",
|
||||
|
|
@ -3692,6 +3697,8 @@
|
|||
"pie_traffic.no_landing":"{city} · nessuna parabola può farlo atterrare",
|
||||
"pie_traffic.orbit_no_fiber":"orbita {o} ms, nessun percorso in fibra",
|
||||
"pie_traffic.orbit_vs_fiber":"orbita {o} ms contro fibra {f} ms",
|
||||
"pie_traffic.patchy":"Clienti del cielo a chiazze",
|
||||
"pie_traffic.patchy_hint":"Boe, posta di bordo e sensori che possono aspettare la prossima torta. Pagano dal {lo} di copertura e passano il testimone ai normali clienti in orbita tra il {min} e il {max}.",
|
||||
"pie_traffic.riding":"Chi viaggia",
|
||||
"pie_traffic.route_ab":"{a} → {b}",
|
||||
"pie_traffic.tab":"Traffico",
|
||||
|
|
|
|||
|
|
@ -3411,6 +3411,7 @@
|
|||
"pie.cr_upper":"Crosta de cima (1.100 km)",
|
||||
"pie.crust_line":"{alt} km · {n} de {full} tortas · {q} a caminho · {p} de cobertura",
|
||||
"pie.dish_note":"Uma antena-torta conversa com as tortas lá em cima. Ela precisa de um POP na cidade e de direitos de pouso no país.",
|
||||
"pie.dish_wait":"As antenas não ganham nada até uma crosta ter {min} de cobertura, e a sua mais cheia está em {p}. Cada uma custa {mo} por mês, então vale a pena esperar. Só boias, navios e sensores pagam antes, a partir de {lo}, e uma antena basta para eles.",
|
||||
"pie.earned":"Ganho da órbita",
|
||||
"pie.earned_mo":"A órbita rende {amt}/mês · {n} antenas fora do backbone não levam trânsito",
|
||||
"pie.factory":"Fábrica de tortas",
|
||||
|
|
@ -3452,6 +3453,10 @@
|
|||
"pie.no_pads":"Ainda sem plataformas de lançamento. Uma plataforma precisa de um POP numa cidade no litoral.",
|
||||
"pie.no_rights":"sem direitos de pouso",
|
||||
"pie.open_pie_control":"Pie Control",
|
||||
"pie.pace_months":{"one":"Neste ritmo ({mo} tortas por mês), esta crosta fica cheia em cerca de {n} mês.","other":"Neste ritmo ({mo} tortas por mês), esta crosta fica cheia em cerca de {n} meses."},
|
||||
"pie.pace_pad":"Outra plataforma a encheria mais rápido. Seu POP litorâneo mais perto do equador é {city}, onde um lançamento custa {p} a menos.",
|
||||
"pie.pace_pad_none":"Outra plataforma a encheria mais rápido: abra um POP no litoral, de preferência perto do equador, onde os lançamentos custam menos.",
|
||||
"pie.pace_years":{"one":"Neste ritmo ({mo} tortas por mês), esta crosta fica cheia em cerca de {n} ano.","other":"Neste ritmo ({mo} tortas por mês), esta crosta fica cheia em cerca de {n} anos."},
|
||||
"pie.pad_busy":"ocupada até {d}",
|
||||
"pie.pad_free":"pronta",
|
||||
"pie.pads":"Plataformas de lançamento",
|
||||
|
|
@ -3692,6 +3697,8 @@
|
|||
"pie_traffic.no_landing":"{city} · nenhuma antena consegue pousá-lo",
|
||||
"pie_traffic.orbit_no_fiber":"órbita {o} ms, sem caminho por fibra",
|
||||
"pie_traffic.orbit_vs_fiber":"órbita {o} ms contra fibra {f} ms",
|
||||
"pie_traffic.patchy":"Clientes de céu com falhas",
|
||||
"pie_traffic.patchy_hint":"Boias, correio de navios e sensores que podem esperar a próxima torta. Pagam a partir de {lo} de cobertura e passam para os clientes orbitais normais entre {min} e {max}.",
|
||||
"pie_traffic.riding":"Quem está a bordo",
|
||||
"pie_traffic.route_ab":"{a} → {b}",
|
||||
"pie_traffic.tab":"Tráfego",
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ const API_STATE_DOC={
|
|||
};
|
||||
|
||||
const API_RESULTS_DOC={
|
||||
pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue, service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'},
|
||||
pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue (rev, including patchy: {mo, cr} from patchy-sky customers who pay from 10% coverage, before a crust carries anything, and fade out between 40% and 60%), service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'},
|
||||
nt:{type:'map',doc:'Traffic per network through transit, by net id.'},
|
||||
tNet:{type:'map',doc:'Traffic per network you hand to each upstream, by "net@upstream".'},
|
||||
reachNT:{type:'number',doc:'Networks reachable without transit.'},
|
||||
|
|
|
|||
|
|
@ -73,6 +73,19 @@ function pieQuote(rk,cr,o={}){const P=S.pie;if(!P||!own(ROCKETS,rk)||!own(CRUSTS
|
|||
// The cheapest a crust can be filled from nothing (one-off costs only): rule O7.
|
||||
function pieFullCost(cr){const C=CRUSTS[cr],base=PIE_CO+PIE_FAC+PIE_PAD,pies=C.full*PIE_PIE;
|
||||
return base+pies+Math.min(...Object.keys(ROCKETS).map(rk=>{const R0=ROCKETS[rk],n=Math.ceil(C.full/R0.pies);return (R0.rd?PIE_RD[R0.rd].cost:0)+(n+(rk==='heavy'?PIE_HEAVY_TESTS:0))*R0.cost;}));}
|
||||
/* The Launch tab's forecast: how long until crust cr is full at today's pace, or null (no factory, no pad that reaches it,
|
||||
no rocket). The rocket is the one last queued for it, else the one that lifts most a day. Each pad flies one every
|
||||
leadDays(gap) (pieLaunch sets pad.next), so the pads lift pies/gap a day each; the factory adds PIE_FAC_MONTH a month,
|
||||
and pies on the shelf and in the queue let the pads outrun it until they are gone. Wear and failures are left out:
|
||||
it says "about". pad: true when the pads, not the factory, set the pace (another pad would help). */
|
||||
function piePace(cr){const P=S.pie;if(!P||!P.fac||!own(CRUSTS,cr))return null;const need=Math.max(0,CRUSTS[cr].full-pieLive(cr)),pads=P.pads.filter(p=>piePadOk(p.city,cr)).length;if(!pads)return null;
|
||||
const use=rk=>pieRkOk(rk)&&!(rk==='heavy'&&pieTests()<PIE_HEAVY_TESTS),rate=rk=>ROCKETS[rk].pies/leadDays(ROCKETS[rk].gap);
|
||||
const L=P.q.filter(x=>x.cr===cr&&!x.test).sort((a,b)=>b.day-a.day)[0],rk=L&&use(L.rk)?L.rk:Object.keys(ROCKETS).filter(use).sort((a,b)=>rate(b)-rate(a))[0];if(!rk)return null;
|
||||
const rp=pads*rate(rk),rf=PIE_FAC_MONTH/30,st=P.stock+P.crusts[cr].queued;let days;
|
||||
if(rp<=rf)days=need/rp;else{const t=st/(rp-rf);days=need<=rp*t?need/rp:t+(need-rp*t)/rf;}
|
||||
return {days:Math.ceil(days),rk,mo:Math.round(Math.min(rp,rf)*30),pad:rp<=rf};}
|
||||
// Where another pad would help crust cr most: the coastal POP nearest the equator that has none and reaches it.
|
||||
function piePadTip(cr){const P=S.pie;return Object.keys(S.pops).filter(c=>!P.pads.some(p=>p.city===c)&&piePadOk(c,cr)).sort((a,b)=>Math.abs(CITY[a].lat)-Math.abs(CITY[b].lat)).find(pieCoast)||null;}
|
||||
function pieCohort(cr,n,las){const c=S.pie.crusts[cr],m=Math.floor(S.day/30),k=c.cohorts.find(x=>x.las===las&&Math.floor(x.day/30)===m);if(k)k.n+=n;else c.cohorts.push({n,day:S.day,las});
|
||||
if(c.cohorts.length>PIE_COHORTS)c.cohorts.splice(0,c.cohorts.length-PIE_COHORTS);}
|
||||
// A launch: every one costs a party; a test always ends in a fireball; the rest fail by the rocket's odds and the chaos rule,
|
||||
|
|
|
|||
21
src/game/60-features/99-pie-patchy.js
Normal file
21
src/game/60-features/99-pie-patchy.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/* ---------- Pie in the Sky: patchy-sky customers (docs/plans/pie-in-the-sky.md) ----------
|
||||
Before a crust carries anything (under PIE_RAW, rule O2), a few customers already pay for a sky with gaps: buoys, ships'
|
||||
mail, cattle tags and weather stations that store their data and send it when a pie passes. They need no routed capacity,
|
||||
so they are a revenue line in pieMoney(), never a flow: routing is unchanged, and so is every game without pies.
|
||||
A crust earns PIE_PATCHY_MO (scaled by its size, Shortcrust's g as 1) x a share that grows from PIE_PATCHY_LO to PIE_RAW
|
||||
coverage, with at least one working pie dish under it. From PIE_RAW they hand over to the real orbit customers: the
|
||||
line shrinks as pieCarry() grows and is gone at PIE_BAKED, so the two are never paid for the same sky in full. */
|
||||
const PIE_PATCHY_MO=30e6,PIE_PATCHY_LO=0.1;
|
||||
// The Dishes tab's hint shows while every crust is under PIE_DISH_WAIT; the Launch tab nudges for a pad past PIE_PACE_SLOW days.
|
||||
const PIE_DISH_WAIT=0.3,PIE_PACE_SLOW=720;
|
||||
// Names for the Traffic tab, shown as more of the sky fills (puns, never real companies).
|
||||
const PIE_PATCHY_NAMES=['Store and Forward Thinking','Buoy Meets Girl Telemetry','Ship Happens Mail','Moo-ving Target Cattle Tags','Whale Hello There Research','Weather or Not Stations','Better Late Than Never Post','Tide Me Over Buoys'];
|
||||
// The share of PIE_PATCHY_MO crust id earns today (0..1): a ramp up to PIE_RAW, then handed over to pieCarry().
|
||||
function piePatchyShare(id){return clamp((pieCov(id)-PIE_PATCHY_LO)/(PIE_RAW-PIE_PATCHY_LO),0,1)*(1-pieCarry(id));}
|
||||
// $/mo from patchy-sky customers, per crust and in total: {mo, cr:{id:$}}. ds: pieDishes() of this compute.
|
||||
function piePatchy(ds){const P=S.pie,o={mo:0,cr:{}};if(!P||P.safe||!ds.length)return o;
|
||||
for(const id in CRUSTS){if(P.crusts[id].down>S.day)continue;const f=piePatchyShare(id);if(!(f>0)||!ds.some(d=>pieCovers(id,d.city)))continue;
|
||||
const v=Math.round(PIE_PATCHY_MO*CRUSTS[id].g/CRUSTS.short.g*f);o.cr[id]=v;o.mo+=v;}
|
||||
return o;}
|
||||
// How many of the names to show for mo $/mo: one per few $M, at least one.
|
||||
const piePatchyN=mo=>clamp(Math.ceil(mo/4e6),1,PIE_PATCHY_NAMES.length);
|
||||
|
|
@ -96,7 +96,7 @@ function pieFast(X,fastSP,A,B,b,wLat){const Ai=CIDX[A],Bi=CIDX[B],nb=X.bh.length
|
|||
if(w.path.some(e=>e.sky&&bad(e)))w=walkI(dijkstra(X.adj,Ai,wLat,(v,e)=>!!e.sky&&bad(e)||!!nb&&nb(e),Bi).P,Ai,Bi);
|
||||
if(w.path.some(e=>e.sky)){X.l2o[b.id]=1;X.l2p[b.id]={w,A,B};}
|
||||
return [{...w,share:1}];}
|
||||
// After routing: what orbit earns (terminals, and a premium on circuits riding the sky) and what each dish carries.
|
||||
// After routing: what orbit earns (terminals, a premium on circuits riding the sky, patchy-sky customers) and what each dish carries.
|
||||
function pieMoney(X,R2,V){let rev=0;const sf={},flows=[];
|
||||
for(const b of S.biz){const T=BIZ_T[b.type];
|
||||
if(T.orbit){const a=X.term[b.id]||0,s=b.bw>0?a/b.bw*(X.gs[b.id]?sfOf(R2,X.gs[b.id]):0):0,v=b.bw*b.rate*Math.min(1,s/0.95);sf[b.id]=s;rev+=v;
|
||||
|
|
@ -107,7 +107,9 @@ function pieMoney(X,R2,V){let rev=0;const sf={},flows=[];
|
|||
const bh=[];for(const e of X.bh){const g=e.ld||0,b=e.bh;used[e.a]+=g;used[e.b]+=g;bhG[e.a]=(bhG[e.a]||0)+g;bhG[e.b]=(bhG[e.b]||0)+g;
|
||||
bh.push({city:e.a,land:e.b,g,cap:e.cap,ms:e.lat,cr:b.cr,las:b.las,km:e.km});flows.push({k:'b',id:'bh:'+e.a,city:e.a,dish:e.b,g,cap:e.cap,ms:e.lat,cr:b.cr,hops:pieBhHops(e,true)});}
|
||||
for(const o of X.bhNo)bh.push({city:o.city,land:null,g:0,cap:0,why:o.why});
|
||||
V.orbit=rev;R2.pie={rev,sf,gs:X.gs,isl:X.isl,used,term:X.gsBw,hubs:X.hubs,sky:X.up.length,flows,bh,...pieLoads(X,flows,used,term,bhG)};
|
||||
// Patchy-sky customers (99-pie-patchy.js): a revenue line before a crust carries anything, handed over as it does.
|
||||
const patchy=piePatchy(X.ds);rev+=patchy.mo;
|
||||
V.orbit=rev;R2.pie={rev,patchy,sf,gs:X.gs,isl:X.isl,used,term:X.gsBw,hubs:X.hubs,sky:X.up.length,flows,bh,...pieLoads(X,flows,used,term,bhG)};
|
||||
// For the lazy fiber comparison (pieFiberMs): the graph of this compute, kept out of JSON.
|
||||
Object.defineProperty(R2.pie,'_x',{value:{adj:X.adj,fm:{}}});}
|
||||
// A sky circuit for the Traffic tab and the traceroute: entry and exit, the dishes it lands at, and each hop through space.
|
||||
|
|
|
|||
|
|
@ -28,14 +28,25 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi
|
|||
<div class="network-name" style="margin-top:6px"><input class="t" id="pieNm" maxlength="40" value="${esc(pieCoName())}" autocomplete="off" aria-label="${esc(tr('pie.name'))}"></div><div class="btns">${btn(tr('slots.rename'),'pieRename',{},'ghost sm')}</div></div>`;
|
||||
h+=`<div class="btns">${btn(P.safe?tr('pie.safe_on'):tr('pie.safe_off'),'pieSafe',{},P.safe?'red sm':'ghost sm')}</div><p class="meta">${tr('pie.safe_note')}</p>`;
|
||||
}else if(T==='fly'){
|
||||
let nudge=false;
|
||||
h+=Object.keys(CRUSTS).map(id=>{const C=CRUSTS[id],cv=pieCov(id);return `<div class="ops-o${pieUp(id)?' on':''}"><div class="nm">${tr(C.n)} ${pieTag(pieBaked(id)?tr('pie.baked'):tr('pie.half_baked'),pieBaked(id))}</div>
|
||||
<div class="meta">${tr('pie.crust_line',{alt:C.alt,n:pieLive(id),full:C.full,q:P.crusts[id].queued,p:pct(cv)})}</div><div class="bar ${cv>=PIE_BAKED?'':'warn'}"><i style="width:${Math.round(cv*100)}%"></i></div>
|
||||
${(()=>{const f=pieLive(id)+P.crusts[id].queued>0&&pieLive(id)<C.full?piePace(id):null;if(!f)return '';
|
||||
const m=Math.max(1,Math.round(f.days/30)),t=m<=24?trn('pie.pace_months',m,{mo:f.mo}):trn('pie.pace_years',Math.round(f.days/360),{mo:f.mo});
|
||||
let x=`<p class="meta pie-pace">${t}</p>`;
|
||||
if(!nudge&&f.pad&&f.days>PIE_PACE_SLOW&&P.pads.length<PIE_PAD_MAX){nudge=true;const c=piePadTip(id);
|
||||
x+=c?`<p class="note pie-nudge">${tr('pie.pace_pad',{city:esc(CITY[c].name),p:pct(pieEq(c))})}</p><div class="btns">${btn(tr('pie.build_pad_price',{city:esc(CITY[c].name),price:fmt$(piePrice(PIE_PAD))}),'piePad',{city:c},'ghost sm',!can)}</div>`
|
||||
:`<p class="note pie-nudge">${tr('pie.pace_pad_none')}</p>`;}
|
||||
return x;})()}
|
||||
<div class="ops-p">${Object.keys(ROCKETS).filter(pieRkOk).map(rk=>{const q=pieQuote(rk,id,{ins:!!UI.pieIns,las:!!UI.pieLas});return btn(`${tr(ROCKETS[rk].n)} <small>${q.ok?(q.test?tr('pie.test_flight')+' · ':'')+fmt$(q.cost):esc(q.why)}</small>`,'pieLaunch',{rk,cr:id},'ghost sm',!q.ok);}).join('')}</div></div>`;}).join('');
|
||||
h+=`<div class="ops-p">${btn(UI.pieIns?tr('pie.ins_on'):tr('pie.ins_off'),'pieIns',{},UI.pieIns?'green sm':'ghost sm')}${btn(UI.pieLas?tr('pie.las_on'):tr('pie.las_off'),'pieLas',{},UI.pieLas?'green sm':'ghost sm')}</div>`;
|
||||
h+=`<p class="meta">${tr('pie.stock_line',{n:Math.floor(P.stock)})}</p>`;
|
||||
if(P.q.length)h+=`<h3 style="font-size:15px;margin:10px 0 4px">${tr('pie.queue')}</h3>`+P.q.slice().sort((a,b)=>a.day-b.day).map(L=>`<div class="kv"><span>${esc(tr(ROCKETS[L.rk].n))} → ${esc(tr(CRUSTS[L.cr].n))}</span><b>${L.test?tr('pie.test_flight'):L.n} · ${esc(CITY[L.pad].name)} · ${dateStr(L.day)}</b></div>`).join('');
|
||||
}else if(T==='dish'){
|
||||
h+=`<p class="meta">${tr('pie.dish_note')}</p>`+P.dishes.map(x=>{const cc=CITY[x.city].cc,ok=pieLicOk(cc);return `<div class="kv"><span>📡 ${esc(CITY[x.city].name)} · ${trn('pie.n_antennas',x.ant)}${ok?'':' · '+tr('pie.no_rights')}</span>${btn(tr('pie.add_antenna',{price:fmt$(piePrice(PIE_ANT))}),'pieAnt',{id:x.id},'ghost sm',!can||x.ant>=PIE_ANT_MAX)}</div>`;}).join('');
|
||||
h+=`<p class="meta">${tr('pie.dish_note')}</p>`;
|
||||
// A gentle hint while the sky is nearly empty: dishes cost money every month and earn nothing yet. Building stays open.
|
||||
{const top=Math.max(...Object.keys(CRUSTS).map(pieCov));if(top<PIE_DISH_WAIT)h+=`<p class="note pie-wait">${tr('pie.dish_wait',{min:pct(PIE_RAW),p:pct(top),mo:fmt$(PIE_DISH_MO),lo:pct(PIE_PATCHY_LO)})}</p>`;}
|
||||
h+=P.dishes.map(x=>{const cc=CITY[x.city].cc,ok=pieLicOk(cc);return `<div class="kv"><span>📡 ${esc(CITY[x.city].name)} · ${trn('pie.n_antennas',x.ant)}${ok?'':' · '+tr('pie.no_rights')}</span>${btn(tr('pie.add_antenna',{price:fmt$(piePrice(PIE_ANT))}),'pieAnt',{id:x.id},'ghost sm',!can||x.ant>=PIE_ANT_MAX)}</div>`;}).join('');
|
||||
h+=sel+`<div class="btns">${btn(tr('pie.build_dish_price',{city:esc(CITY[c].name),price:fmt$(piePrice(PIE_DISH+PIE_ANT))}),'pieDish',{city:c},'ghost sm',!can||P.dishes.some(x=>x.city===c))}</div>`;
|
||||
const ccs=[...new Set([...P.dishes.map(x=>CITY[x.city].cc),CITY[c].cc,...Object.keys(P.lic)])];
|
||||
h+=`<h3 style="font-size:15px;margin:10px 0 4px">${tr('pie.landing_rights')}</h3>`+ccs.map(cc=>{const l=P.lic[cc],ok=pieLicOk(cc);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ function pieBhRow(b){const id='bh:'+b.city,hi=UI.pieHi===id;
|
|||
function pieTrafficHtml(){const Q=R&&R.pie;if(!Q||!Q.flows)return `<p class="meta">${tr('pie_traffic.no_data')}</p>`;
|
||||
const bh=Q.bh||[],bg=bh.reduce((a,b)=>a+b.g,0),fl=Q.flows.filter(f=>f.k!=='b'&&(f.g>0||f.k==='t')).sort((a,b)=>b.g-a.g),g=fl.reduce((a,f)=>a+f.g,0),n=fl.filter(f=>f.g>0).length,B=new Map(S.biz.map(b=>[b.id,b]));
|
||||
let h=`<p class="pft-head">${trn('pie_traffic.headline',n,{g:fmtG(g),of:fmtG(pieMarket()),amt:fmt$(Q.rev)})}</p>`;
|
||||
// Patchy-sky customers (99-pie-patchy.js): money, no traffic, so a line of its own.
|
||||
if(Q.patchy&&Q.patchy.mo>0)h+=`<div class="ops-o pft-patchy"><div class="kv"><span>📶 ${tr('pie_traffic.patchy')}</span><b>${tr('common.price_mo',{price:fmt$(Q.patchy.mo)})}</b></div>
|
||||
<p class="meta">${esc(PIE_PATCHY_NAMES.slice(0,piePatchyN(Q.patchy.mo)).join(' · '))}</p><p class="meta">${tr('pie_traffic.patchy_hint',{lo:pct(PIE_PATCHY_LO),min:pct(PIE_RAW),max:pct(PIE_BAKED)})}</p></div>`;
|
||||
if(!(g>0)&&!(bg>0))h+=`<div class="ops-o pft-why"><div class="nm">${tr('pie_traffic.empty_title')}</div><ul class="pft-ck">${pieChecks(Q).map(c=>`<li class="${c.ok?'on':'off'}" data-k="${c.k}"><span aria-hidden="true">${c.ok?'✅':'⬜'}</span><span><b>${c.l}</b>${c.ok?'':`<small>${c.h}</small>`}</span></li>`).join('')}</ul></div>`;
|
||||
h+=`<h3 class="pft-h">${tr('pie_traffic.crusts')}</h3>`+(Q.crust.length?Q.crust.map(c=>{const why=pieCrustWhy(c);
|
||||
return `<div class="pft-cr"><div class="kv"><span>${tr(CRUSTS[c.id].n)} ${pieTag(c.st==='half'||c.st==='part'?tr('pie.half_baked'):tr('pie.baked'),c.st!=='half'&&c.st!=='part')}</span><b>${c.cap>0?tr('pie_traffic.used_of',{u:fmtG(c.used),cap:fmtG(c.cap)}):pct(c.cov)}</b></div>
|
||||
|
|
|
|||
|
|
@ -3412,6 +3412,7 @@
|
|||
"pie.cr_upper":"Upper Crust (1,100 km)",
|
||||
"pie.crust_line":"{alt} km · {n} of {full} pies · {q} on the way · {p} covered",
|
||||
"pie.dish_note":"A pie dish talks to the pies overhead. It needs a POP in its city and landing rights in its country.",
|
||||
"pie.dish_wait":"Dishes earn nothing until a crust is {min} covered, and your fullest is at {p}. Each one costs {mo} a month to run, so it pays to wait. Only buoys, ships and sensors pay earlier, from {lo}, and one dish is enough for them.",
|
||||
"pie.earned":"Earned from orbit",
|
||||
"pie.earned_mo":"Orbit earns {amt}/mo · {n} dishes off the backbone carry no transit",
|
||||
"pie.factory":"Pie factory",
|
||||
|
|
@ -3453,6 +3454,10 @@
|
|||
"pie.no_pads":"No launch pads yet. A pad needs a POP in a city on the coast.",
|
||||
"pie.no_rights":"no landing rights",
|
||||
"pie.open_pie_control":"Pie Control",
|
||||
"pie.pace_months":{"one":"At this pace ({mo} pies a month), this crust is full in about {n} month.","other":"At this pace ({mo} pies a month), this crust is full in about {n} months."},
|
||||
"pie.pace_pad":"Another pad would fill it faster. Your coastal POP nearest the equator is {city}, where a launch costs {p} less.",
|
||||
"pie.pace_pad_none":"Another pad would fill it faster: open a POP on a coast, ideally near the equator, where launches cost less.",
|
||||
"pie.pace_years":{"one":"At this pace ({mo} pies a month), this crust is full in about {n} year.","other":"At this pace ({mo} pies a month), this crust is full in about {n} years."},
|
||||
"pie.pad_busy":"busy until {d}",
|
||||
"pie.pad_free":"ready",
|
||||
"pie.pads":"Launch pads",
|
||||
|
|
@ -3693,6 +3698,8 @@
|
|||
"pie_traffic.no_landing":"{city} · no dish can land it",
|
||||
"pie_traffic.orbit_no_fiber":"orbit {o} ms, no fiber path",
|
||||
"pie_traffic.orbit_vs_fiber":"orbit {o} ms vs fiber {f} ms",
|
||||
"pie_traffic.patchy":"Patchy-sky customers",
|
||||
"pie_traffic.patchy_hint":"Buoys, ships' mail and sensors that can wait for the next pie. They pay from {lo} covered and hand over to regular orbit customers between {min} and {max}.",
|
||||
"pie_traffic.riding":"Who's riding",
|
||||
"pie_traffic.route_ab":"{a} → {b}",
|
||||
"pie_traffic.tab":"Traffic",
|
||||
|
|
|
|||
169
tests/pie-pace.test.js
Normal file
169
tests/pie-pace.test.js
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
// Pie in the Sky, the early game: the Launch tab's pace forecast and pad nudge (piePace, piePadTip), patchy-sky customers
|
||||
// who pay before a crust carries anything (60-features/99-pie-patchy.js), and the Dishes tab's hint to wait.
|
||||
// Seeded; state is set directly where luck would decide.
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
// A sandbox rocket company (with real lead times, as on On-call) with a factory and a pad in Lisbon (39°N), 20 pies on the shelf.
|
||||
const company = (ev) => {
|
||||
ev("ACT.modeSet({m:'sandbox'});ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.nextFail=1e9;S.nextEvent=1e9;S.rules.lead='real'");
|
||||
ev("for(const c of ['fra','sin','lis'])if(!S.pops[c])ACT.buildPop({city:c});ACT.pieFound();ACT.pieFactory();ACT.piePad({city:'lis'});S.pie.stock=20;compute()");
|
||||
};
|
||||
const cover = (ev, cov, id = 'short') => ev(`S.pie.crusts.${id}.cohorts=[{n:Math.ceil(CRUSTS.${id}.full*${cov}),day:S.day,las:false}];compute()`);
|
||||
const dish = (ev, c) => ev(`ACT.pieDish({city:'${c}'});S.pie.lic[CITY['${c}'].cc]={state:'ok',until:1e6};compute()`);
|
||||
const doc = (dom) => dom.window.document;
|
||||
|
||||
test('the Launch tab says when a crust is full at this pace, and nudges for a pad near the equator when it is slow', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
company(ev);
|
||||
assert.equal(ev("S.pie.pads.length"), 1);
|
||||
ev("ACT.pieLaunch({rk:'falcon',cr:'short'})");
|
||||
// One pad, a Falcon every 14 days: 20/14 pies a day, slower than the factory's 4, so the pad sets the pace.
|
||||
const f = JSON.parse(ev("JSON.stringify(piePace('short'))"));
|
||||
assert.equal(f.rk, 'falcon');
|
||||
assert.equal(f.pad, true);
|
||||
assert.equal(f.mo, 43);
|
||||
assert.equal(f.days, Math.ceil(1584 / (20 / 14)), 'the whole crust at one launch per gap');
|
||||
ev("ACT.pieTab({t:'fly'})");
|
||||
const html = () => doc(dom).getElementById('modal').innerHTML;
|
||||
assert.match(html(), /At this pace \(43 pies a month\), this crust is full in about 3 years\./);
|
||||
// The nudge names the coastal POP nearest the equator (Singapore, 1°N) and builds a pad there in one tap.
|
||||
assert.equal(ev("piePadTip('short')"), 'sin');
|
||||
assert.match(html(), /Your coastal POP nearest the equator is Singapore, where a launch costs 15% less\./);
|
||||
const b = doc(dom).querySelector('#modal .pie-nudge + .btns [data-act=piePad]');
|
||||
assert.ok(b && !b.disabled, 'a pad button under the nudge');
|
||||
assert.equal(JSON.parse(b.dataset.args).city, 'sin');
|
||||
assert.equal(doc(dom).querySelectorAll('#modal .pie-nudge').length, 1, 'one nudge, not one per crust');
|
||||
// Only started crusts get a forecast: Shortcrust is the only one with pies on the way.
|
||||
assert.equal(doc(dom).querySelectorAll('#modal .pie-pace').length, 1);
|
||||
b.click();
|
||||
assert.equal(ev("S.pie.pads.length"), 2);
|
||||
// Two pads: twice the pace, under two years, no nudge.
|
||||
const g = JSON.parse(ev("JSON.stringify(piePace('short'))"));
|
||||
assert.equal(g.days, Math.ceil(1584 / (40 / 14)));
|
||||
assert.match(html(), /full in about 19 months\./);
|
||||
assert.equal(doc(dom).querySelectorAll('#modal .pie-nudge').length, 0);
|
||||
ev('closeModal()');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the pace counts the factory: pads that outrun it fly from the shelf, then at its pace, and get no nudge', () => {
|
||||
const { ev, errors } = load();
|
||||
company(ev);
|
||||
ev("ACT.pieRd({k:'reuse'});ACT.piePad({city:'sin'});ACT.buildPop({city:'mia'});ACT.piePad({city:'mia'});S.pie.stock=200;ACT.pieLaunch({rk:'again',cr:'short'})");
|
||||
const f = JSON.parse(ev("JSON.stringify(piePace('short'))"));
|
||||
// Three reusable pads lift 6 a day, the factory bakes 4: 180 pies on the shelf and 20 queued last 100 days at 6 a day.
|
||||
assert.equal(f.rk, 'again');
|
||||
assert.equal(f.pad, false, 'the factory sets the pace');
|
||||
assert.equal(f.mo, 120);
|
||||
assert.equal(f.days, Math.ceil(100 + (1584 - 600) / 4));
|
||||
// Nothing to forecast without a factory, or once the crust is full.
|
||||
cover(ev, 1);
|
||||
ev("ACT.pieTab({t:'fly'})");
|
||||
assert.equal(ev("document.querySelectorAll('#modal .pie-pace').length"), 0);
|
||||
ev("S.pie.fac=false");
|
||||
assert.equal(ev("piePace('short')"), null);
|
||||
ev('closeModal()');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('patchy-sky customers pay a little from 10% coverage and hand over to regular orbit customers from 40% to 60%', () => {
|
||||
const { ev, errors } = load();
|
||||
company(ev);
|
||||
const mo = (cov) => { cover(ev, cov); return ev('R.pie.patchy.mo'); };
|
||||
assert.equal(mo(0.25), 0, 'nothing without a working dish');
|
||||
dish(ev, 'sin');
|
||||
const at = [0.05, 0.1, 0.2, 0.3, 0.4, 0.45, 0.5, 0.55, 0.6, 0.8].map((c) => [c, mo(c)]);
|
||||
const v = Object.fromEntries(at);
|
||||
assert.equal(v[0.05], 0);
|
||||
assert.ok(v[0.1] < 0.1e6, 'from 10%');
|
||||
assert.ok(Math.abs(v[0.4] - 30e6) < 0.2e6, `the most it pays is tens of $M a month (${v[0.4]})`);
|
||||
for (let i = 1; i < at.length; i++) {
|
||||
const [c, x] = at[i], p = at[i - 1][1];
|
||||
if (c <= 0.4) assert.ok(x >= p, `grows up to 40% (${c}: ${x} < ${p})`);
|
||||
else assert.ok(x <= p, `shrinks from 40% (${c}: ${x} > ${p})`);
|
||||
}
|
||||
assert.equal(v[0.6], 0, 'gone once the crust is baked');
|
||||
assert.equal(v[0.8], 0);
|
||||
// No double counting: what is left of it plus the share the crust carries is the whole sky, never more.
|
||||
cover(ev, 0.5);
|
||||
assert.ok(Math.abs(ev("piePatchyShare('short')+pieCarry('short')") - 1) < 1e-9);
|
||||
// It is orbit income: in R.pie.rev, the month's revenue and the books, and never a flow, so routing is unchanged.
|
||||
cover(ev, 0.3);
|
||||
const r = JSON.parse(ev("JSON.stringify({rev:R.pie.rev,p:R.pie.patchy.mo,flows:R.pie.flows.length,cr:R.pie.patchy.cr})"));
|
||||
assert.ok(r.p > 15e6 && r.p < 25e6, `${r.p}`);
|
||||
assert.equal(r.rev, r.p, 'no other orbit customers yet');
|
||||
assert.equal(r.flows, 0);
|
||||
assert.deepEqual(Object.keys(r.cr), ['short']);
|
||||
assert.ok(ev('R.revMo') >= r.p);
|
||||
const e0 = ev('S.pie.book.earned');
|
||||
ev('dayTick()');
|
||||
assert.ok(Math.abs(ev('S.pie.book.earned') - e0 - r.p / 30) < r.p / 300, 'booked day by day');
|
||||
// Safe mode, a crust down for a storm: nothing.
|
||||
ev("S.pie.safe=true;compute()");
|
||||
assert.equal(ev('R.pie.patchy.mo'), 0);
|
||||
ev("S.pie.safe=false;S.pie.crusts.short.down=S.day+5;compute()");
|
||||
assert.equal(ev('R.pie.patchy.mo'), 0);
|
||||
ev("S.pie.crusts.short.down=0;compute()");
|
||||
assert.ok(ev('R.pie.patchy.mo') > 0);
|
||||
ev('closeModal()');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the Traffic tab shows patchy-sky customers with their names, and a game without a rocket company has none', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
company(ev);
|
||||
dish(ev, 'sin');
|
||||
cover(ev, 0.3);
|
||||
ev("ACT.pieTab({t:'traffic'})");
|
||||
const row = doc(dom).querySelector('#modal .pft-patchy');
|
||||
assert.ok(row, 'a patchy-sky row');
|
||||
assert.match(row.textContent, /Patchy-sky customers/);
|
||||
assert.match(row.textContent, /Store and Forward Thinking/);
|
||||
assert.match(row.textContent, /\$20(\.\d)?M\/mo/);
|
||||
// Phones: the row is a plain block in the sheet, nothing wider than the screen.
|
||||
assert.ok(!/width:\s*\d{3,}px/.test(row.outerHTML));
|
||||
ev('closeModal()');
|
||||
// Without pies: no orbit at all.
|
||||
const g = load();
|
||||
g.ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();ACT.launchBB({city:'fra'});compute()");
|
||||
assert.equal(g.ev('R.pie'), undefined);
|
||||
assert.deepEqual(errors, []);
|
||||
assert.deepEqual(g.errors, []);
|
||||
});
|
||||
|
||||
test('the Dishes tab says dishes earn nothing while the sky is nearly empty, and still lets you build', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
company(ev);
|
||||
cover(ev, 0.12);
|
||||
ev("UI.pieCity='sin';ACT.pieTab({t:'dish'})");
|
||||
const hint = () => doc(dom).querySelector('#modal .pie-wait');
|
||||
assert.ok(hint(), 'the hint');
|
||||
assert.match(hint().textContent, /Dishes earn nothing until a crust is 40% covered, and your fullest is at 12%\./);
|
||||
assert.match(hint().textContent, /\$300k a month/);
|
||||
const b = doc(dom).querySelector('#modal [data-act=pieDish]');
|
||||
assert.ok(b && !b.disabled, 'building is not blocked');
|
||||
cover(ev, 0.35);
|
||||
ev("ACT.pieTab({t:'dish'})");
|
||||
assert.equal(hint(), null, 'gone from 30%');
|
||||
ev('closeModal()');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
// The playtest: one pad, dishes in every city on day one, launches as fast as the pad allows. Year one now shows a
|
||||
// small orbit income before the crust carries anything: tens of $M a month at most, never hundreds.
|
||||
test('a hasty player sees a small orbit income in the first year', { timeout: 120000 }, () => {
|
||||
const { ev, errors } = load();
|
||||
company(ev);
|
||||
ev("S.pie.stock=40;for(const c of Object.keys(S.pops))dish(c);function dish(c){ACT.pieDish({city:c});S.pie.lic[CITY[c].cc]={state:'ok',until:1e6};}compute()");
|
||||
ev("window.__m=[];for(let d=0;d<360;d++){if(pieQuote('falcon','short').ok)ACT.pieLaunch({rk:'falcon',cr:'short'});S.nextFail=1e9;S.nextEvent=1e9;dayTick();if(d%30===29){compute();__m.push([pieCov('short'),R.pie.patchy.mo,R.pie.rev]);}}");
|
||||
const m = JSON.parse(ev('JSON.stringify(__m)'));
|
||||
const top = Math.max(...m.map((x) => x[1]));
|
||||
assert.ok(m[m.length - 1][0] < 0.4, `still under 40% after a year on one pad (${m[m.length - 1][0]})`);
|
||||
assert.ok(top >= 5e6, `visible: ${top}`);
|
||||
assert.ok(top <= 50e6, `small: ${top}`);
|
||||
assert.ok(m.every((x) => x[2] === x[1]), 'all of it from patchy-sky customers');
|
||||
ev('closeModal()');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
@ -60,7 +60,9 @@ test('O2: a crust carries nothing under 40%, a share up to 60%, and orbit never
|
|||
assert.deepEqual(ev('JSON.stringify(pieHubs())'), '[]');
|
||||
assert.equal(skyOf(ev, 'hft1'), false);
|
||||
assert.equal(ev("R.pie.sf.pz"), 0, 'a home on Pitcairn gets nothing from a half-baked crust');
|
||||
assert.equal(ev('R.pie.rev'), 0);
|
||||
// the only orbit money under 40% is patchy-sky customers (99-pie-patchy.js), who need no traffic carried
|
||||
assert.equal(ev('R.pie.rev'), ev('R.pie.patchy.mo'));
|
||||
assert.equal(ev("R.pie.flows.filter(f=>f.g>0).length"), 0);
|
||||
// half-baked at 50%: a quarter of the crust's Gbps (half its pies, half of those carrying) and a quarter of the market
|
||||
ev("S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full/2,day:S.day,las:true}];compute()");
|
||||
assert.deepEqual(ev('JSON.stringify(pieHubs())'), '["short"]', 'over 40% it is a hub');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue