docs: clarify priceOf stock contract (review)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { GOODS, BASE_PRICE, TYPICAL_STOCK, MAX_STOCK } from './constants.js';
|
||||
|
||||
// Deterministic price curve: scarce -> expensive. Clamped to [0.25x, 4x].
|
||||
// Always pass the raw float planet.stock[good]; never reconstruct price from
|
||||
// the floored integer stock shown in marketView rows.
|
||||
export function priceOf(good, stock) {
|
||||
const ratio = TYPICAL_STOCK / Math.max(stock, 1);
|
||||
const mult = Math.min(4, Math.max(0.25, ratio));
|
||||
|
||||
Reference in New Issue
Block a user