Latency offers only ask for a ceiling a build can meet (#273)
The ceiling came from the straight-line distance, and nothing checked that a path could reach it: Pevek-Anadyr asked for 4.3 ms over a 7.7 ms sea route. latFloor() is the fastest a build could get, over own fiber on land and the routes of cables that land at both ends; an offer whose ceiling is below that and below what you already have is not made, as diverse offers are not.
This commit is contained in:
parent
24d865aa57
commit
c7fd54b067
4 changed files with 55 additions and 1 deletions
|
|
@ -129,5 +129,7 @@ function spawnOffer(){
|
|||
if(Math.random()<(T.lv>=3?0.65:0.3))reqs.push(pick(pool));
|
||||
if(T.lv>=3&&Math.random()<0.35){const more=pool.filter(k=>!reqs.includes(k));if(more.length)reqs.push(pick(more));}
|
||||
const r2=Math.round(rate*(1+reqs.reduce((a,k)=>a+REQS[k].bonus,0)));
|
||||
S.offers.push({id:uid(),city,city2,name,type:t,bw,rate:r2,reqs,latMax:T.lat?+(kmBetween(city,city2)/200*1.35).toFixed(1):null,exp:S.day+40});
|
||||
// A latency ceiling must be one something you can build meets (#273), as diverse paths must be possible.
|
||||
const latMax=T.lat?latMaxOf(city,city2):null;if(T.lat&&!(Math.min(latFloor(city,city2),bestLat(city,city2))<=latMax))return;
|
||||
S.offers.push({id:uid(),city,city2,name,type:t,bw,rate:r2,reqs,latMax,exp:S.day+40});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue