Line data Source code
1 : /** 2 : * Normalize the trade gain as a function of mapSize for a default of: size=1024 and distance= 100m 3 : */ 4 : function TradeGainNormalization(mapSize) 5 : { 6 0 : return Math.sqrt(1024 / mapSize) / TradeGain(10000, mapSize); 7 : } 8 : 9 : /** 10 : * Part of the trade gain which depends on the distance, the full gain being TradeGainNormalization * TradeGain. 11 : */ 12 : function TradeGain(distanceSquared, mapSize) 13 : { 14 0 : return distanceSquared / (1 + 0.25 * Math.sqrt(distanceSquared) / mapSize); 15 : }