plan-lab: spillover placement and zero-recruit cash switches; tenure and team-funded metrics

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-27 20:00:17 -05:00
parent d562d61cbc
commit 53f0970209
2 changed files with 36 additions and 4 deletions
+33 -3
View File
@@ -5,6 +5,8 @@
// wm: cash watermark. A member who qualifies late is paid cash only by their own directs and by positions created after they qualified.
const PLAN = { w: 4, maxL: 8, shape: 'stepped', steps: [10,20,50,100,175,300,500,750], gap: 'fund', unq: 'licence', wm: true,
// placeholder products, one per level, until the real ones exist (Marty, 27 Sep): edit in the plan row
place: 'shallow', // spillover placement: 'shallow' = shallowest open slot; 'spread' = the position with the fewest under it first (then shallowest)
zero: false, // cash with no recruits: false = entries only; true = entries + level-2 cash from your own depth 1
split: 0.5, // entry split: this share of the net entry to the placement upline, the rest to the recruiter (decided 27 Sep)
half: true, // one-direct half step: one recruit unlocks cash from depths 1-2 (levels 2-3); two recruits unlock full reach
fee: 0.20, // admin fee, OUT of every price, to a receiver wallet in the same block (Marty, 27 Sep: 20%, same as InstantAdPay). The other 80% climbs.
@@ -159,6 +161,7 @@
const own = !PLAN.wm || !origin || origin.parent === u;
if (u.directs >= 2) return own || origin.id >= u.cashFrom;
if (PLAN.half && u.directs === 1 && L <= 3) return own || origin.id >= u.cashFromHalf;
if (PLAN.zero && L <= 2) return true;
return false;
}
function route(from, L, skipN, rem, origin){
@@ -570,7 +573,19 @@
G.members.push(m); if (parent) parent.kids.push(m);
return m;
}
function gSlot(root){ const q = [root]; while (q.length) { const n = q.shift(); if (n.kids.length < PLAN.w) return n; for (const k of n.kids) q.push(k); } return root; }
function gSlot(root){
if (PLAN.place !== 'spread') { const q = [root]; while (q.length) { const n = q.shift(); if (n.kids.length < PLAN.w) return n; for (const k of n.kids) q.push(k); } return root; }
// spread: still fill the shallowest depth first, but within that depth give the position with the fewest
// children the next one, so each gets one before any gets two (plain breadth-first fills one position to
// four before the next gets any). A pure "fewest children anywhere" rule turns the org into a chain.
let level = [root];
while (level.length) {
const open = level.filter(n => n.kids.length < PLAN.w);
if (open.length) { let best = open[0]; for (const n of open) if (n.kids.length < best.kids.length) best = n; return best; }
const next = []; for (const n of level) for (const k of n.kids) next.push(k); level = next;
}
return root;
}
// an entry: placed breadth-first under the recruiter (or assigned to a member short of a direct), paid, split
function gJoin(recruiter, month, unsponsored){
if (!recruiter) { // assigned: earliest member with one recruit, else earliest with none (never you)
@@ -590,6 +605,7 @@
const own = !PLAN.wm || origin.recruiter === u;
if (u.directs >= 2) return own || origin.id >= u.cashFrom;
if (PLAN.half && u.directs === 1 && L <= 3) return own || origin.id >= u.cashFromHalf;
if (PLAN.zero && L <= 2) return true; // level-2 money from your own depth 1 needs no recruits
return false;
}
function gRoute(from, L, skipN, rem, origin){
@@ -610,7 +626,7 @@
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){ 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); gPay(m, L, gross - fee, L - 2, m, false); }
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); gPay(m, L, gross - fee, L - 2, m, false); }
function gNewMonth(){ G.mon = { in: 0, admin: 0, joins: 0, assigned: 0, buys: 0, lics: 0, above: 0 }; }
function gReset(){
rnd = mulberry32(7);
@@ -678,7 +694,13 @@
const pct = (p) => ms.length ? ms[Math.min(ms.length - 1, Math.floor(ms.length * p))] : 0;
const top10 = ms.slice(0, Math.max(1, Math.round(ms.length * 0.1))).reduce((a, b) => a + b, 0), all = ms.reduce((a, b) => a + b, 0);
const lv = {}; for (const x of G.members) if (x !== G.you) lv[x.level] = (lv[x.level] || 0) + 1;
sp.innerHTML = 'Top earner in the org: <b>' + $$(ms[0] || 0) + '</b>. Top 10% of members took ' + (all ? Math.round(100 * top10 / all) : 0) + '% of what members received. Median member: <b>' + $$(pct(0.5)) + '</b>. Members with nothing: ' + cnt(ms.filter(v => v <= 0).length) + '.<br>Levels held: ' + Object.keys(lv).map(Number).sort((a, b) => a - b).map(L => 'L' + L + ' ' + cnt(lv[L])).join(' \u00b7 ') + '.';
const older = G.members.filter(x => x !== G.you && G.month - x.month >= 6), olderPaid = older.filter(x => x.cash + x.entry > 0);
const olderVals = older.map(x => x.cash + x.entry).sort((a, b) => b - a), olderMed = olderVals.length ? olderVals[Math.floor(olderVals.length / 2)] : 0;
const carried = G.members.filter(x => x !== G.you && x.level >= 2 && !(x.bought || 0)).length, ownBuy = G.members.filter(x => x !== G.you && (x.bought || 0) > 0).length;
sp.innerHTML = 'Top earner in the org: <b>' + $$(ms[0] || 0) + '</b>. Top 10% of members took ' + (all ? Math.round(100 * top10 / all) : 0) + '% of what members received. Median member: <b>' + $$(pct(0.5)) + '</b>. Members with nothing: ' + cnt(ms.filter(v => v <= 0).length) + ' (most of them joined recently).'
+ '<br><b>Members in for 6 months or more:</b> ' + cnt(older.length) + ', of whom ' + cnt(olderPaid.length) + ' (' + (older.length ? Math.round(100 * olderPaid.length / older.length) : 0) + '%) have been paid; their median is <b>' + $$(olderMed) + '</b>.'
+ '<br><b>Product without paying:</b> ' + cnt(carried) + ' members hold level 2 or higher purely from licences their team funded; ' + cnt(ownBuy) + ' bought at least one level themselves.'
+ '<br>Levels held: ' + Object.keys(lv).map(Number).sort((a, b) => a - b).map(L => 'L' + L + ' ' + cnt(lv[L])).join(' \u00b7 ') + '.';
}
}
function gRun(k){ for (let i = 0; i < k; i++) gMonth(); }
@@ -706,6 +728,10 @@
document.getElementById('gapFund').setAttribute('aria-pressed', String(PLAN.gap === 'fund'));
document.getElementById('unqSkip').setAttribute('aria-pressed', String(PLAN.unq === 'skip'));
document.getElementById('unqLic').setAttribute('aria-pressed', String(PLAN.unq === 'licence'));
document.getElementById('plShallow').setAttribute('aria-pressed', String(PLAN.place === 'shallow'));
document.getElementById('plSpread').setAttribute('aria-pressed', String(PLAN.place === 'spread'));
document.getElementById('zeroOff').setAttribute('aria-pressed', String(!PLAN.zero));
document.getElementById('zeroOn').setAttribute('aria-pressed', String(PLAN.zero));
document.getElementById('halfOff').setAttribute('aria-pressed', String(!PLAN.half));
document.getElementById('halfOn').setAttribute('aria-pressed', String(PLAN.half));
document.getElementById('wmOff').setAttribute('aria-pressed', String(!PLAN.wm));
@@ -724,6 +750,10 @@
document.getElementById('gapFund').addEventListener('click', () => { PLAN.gap = 'fund'; applyPlan(); });
document.getElementById('unqSkip').addEventListener('click', () => { PLAN.unq = 'skip'; applyPlan(); });
document.getElementById('unqLic').addEventListener('click', () => { PLAN.unq = 'licence'; applyPlan(); });
document.getElementById('plShallow').addEventListener('click', () => { PLAN.place = 'shallow'; applyPlan(); });
document.getElementById('plSpread').addEventListener('click', () => { PLAN.place = 'spread'; applyPlan(); });
document.getElementById('zeroOff').addEventListener('click', () => { PLAN.zero = false; applyPlan(); });
document.getElementById('zeroOn').addEventListener('click', () => { PLAN.zero = true; applyPlan(); });
document.getElementById('halfOff').addEventListener('click', () => { PLAN.half = false; applyPlan(); });
document.getElementById('halfOn').addEventListener('click', () => { PLAN.half = true; applyPlan(); });
document.getElementById('wmOff').addEventListener('click', () => { PLAN.wm = false; applyPlan(); });
+3 -1
View File
@@ -240,6 +240,8 @@ details.adv.big summary{font-size:18px}
<div class="ctl" id="priceCtl" hidden><label for="price">Level-1 price P</label><div><input id="price" type="range" min="5" max="250" step="5" value="25"><span class="val" id="priceVal">$25</span></div></div>
<div class="ctl"><label>Gap rule</label><div class="seg" role="group" aria-label="Gap rule"><button type="button" id="gapSkip" aria-pressed="false">RM Circle skip</button><button type="button" id="gapFund" aria-pressed="true">Fund the gap</button></div></div>
<div class="ctl"><label>Unqualified members</label><div class="seg" role="group" aria-label="Unqualified members"><button type="button" id="unqSkip" aria-pressed="false">Skipped</button><button type="button" id="unqLic" aria-pressed="true">Licences, never cash</button></div></div>
<div class="ctl"><label>Spillover placement</label><div class="seg" role="group" aria-label="Placement"><button type="button" id="plShallow" aria-pressed="true">Shallowest slot</button><button type="button" id="plSpread" aria-pressed="false">Spread: emptiest first</button></div></div>
<div class="ctl"><label>Cash with no recruits</label><div class="seg" role="group" aria-label="Zero recruits"><button type="button" id="zeroOff" aria-pressed="true">Entries only</button><button type="button" id="zeroOn" aria-pressed="false">Entries + level 2</button></div></div>
<div class="ctl"><label>One-direct half step</label><div class="seg" role="group" aria-label="Half step"><button type="button" id="halfOff" aria-pressed="false">Off: cash needs two</button><button type="button" id="halfOn" aria-pressed="true">On: one direct = depths 1-2</button></div></div>
<div class="ctl"><label>Late qualifiers</label><div class="seg" role="group" aria-label="Late qualifiers"><button type="button" id="wmOff" aria-pressed="false">Cash from everyone</button><button type="button" id="wmOn" aria-pressed="true">Cash from new positions only</button></div></div>
</details>
@@ -325,6 +327,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=20260927f"></script>
<script src="/assets/plan-lab.js?v=20260927g"></script>
</body>
</html>