plan-lab: each leg funds licences at its own share, so join-and-pay members keep their path

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-28 08:58:35 -05:00
parent 257b06d6d2
commit 39951cfac5
2 changed files with 11 additions and 9 deletions
+10 -8
View File
@@ -626,12 +626,14 @@
}
function gPayS(from, L, amt, origin, rem){
let r = gRouteS(from, L, rem, origin);
if (r.to && r.kind === 'lic' && amt < net(r.to.level + 1) - 0.005) r = gRouteS(from, L, true, origin);
if (r.to && r.kind === 'lic' && amt < net(r.to.level + 1) * PLAN.sponsor - 0.005) r = gRouteS(from, L, true, origin);
if (!r.to) { G.aud.above += amt; G.aud.received += amt; G.mon.above += amt; return; }
if (r.kind === 'cash') { r.to.cash += amt; r.to.sp += amt; G.mon.sp += amt; G.aud.received += amt; return; }
const n = r.to.level + 1, cost = net(n);
r.to.level = n; r.to.lic++; r.to.licV += cost; G.mon.lics++;
gFlow(r.to, n, cost, origin);
// each leg funds licences at its own share of the price: this leg's licence costs the sponsor share of level n,
// and that cost climbs the sponsor line. A licence is still a full level (licV records its full value).
const n = r.to.level + 1, cost = net(n) * PLAN.sponsor;
r.to.level = n; r.to.lic++; r.to.licV += net(n); G.mon.lics++;
gPayS(r.to, n, cost, origin, false);
if (amt - cost > 0.005) gPayS(r.to, L, amt - cost, origin, true);
}
// every purchase, paid or licence, splits the same way: sponsor leg first, the rest by depth
@@ -647,12 +649,12 @@
}
function gPay(from, L, amt, skipN, origin, rem){
let r = gRoute(from, L, skipN, rem, origin);
if (r.to && r.kind === 'lic' && amt < net(r.to.level + 1) - 0.005) r = gRoute(from, L, skipN, true, origin); // short money never buys a licence; it climbs as cash
if (r.to && r.kind === 'lic' && amt < net(r.to.level + 1) * (1 - PLAN.sponsor) - 0.005) r = gRoute(from, L, skipN, true, origin); // short money never buys a licence; it climbs as cash
if (!r.to) { G.aud.above += amt; G.aud.received += amt; G.mon.above += amt; return; }
if (r.kind === 'cash') { r.to.cash += amt; G.aud.received += amt; return; }
const n = r.to.level + 1, cost = net(n);
r.to.level = n; r.to.lic++; r.to.licV += cost; G.mon.lics++;
gFlow(r.to, n, cost, origin);
const n = r.to.level + 1, cost = net(n) * (1 - PLAN.sponsor); // the depth leg's share of level n; with the sponsor leg off this is the whole price, as before
r.to.level = n; r.to.lic++; r.to.licV += net(n); G.mon.lics++;
gPay(r.to, n, cost, n - 2, origin, false);
if (amt - cost > 0.005) gPay(r.to, L, amt - cost, 0, origin, true);
}
function gBuy(m, L){ m.bought = (m.bought || 0) + 1; const gross = price(L), fee = gross * PLAN.fee; G.aud.spent += gross; G.aud.admin += fee; G.aud.received += fee; G.mon.in += gross; G.mon.admin += fee; G.mon.buys++; m.level = Math.max(m.level, L); gFlow(m, L, gross - fee, m); }
+1 -1
View File
@@ -353,6 +353,6 @@ details.adv.big summary{font-size:18px}
<p class="fine">Unlisted working page for planning. Not a member page, not an offer. Every number here is a mechanic, not a prediction.</p>
<script src="/assets/plan-lab.js?v=20260928-0854"></script>
<script src="/assets/plan-lab.js?v=20260928-0858"></script>
</body>
</html>