diff --git a/public/assets/plan-lab.js b/public/assets/plan-lab.js
index 84e87f6..aaea3a5 100644
--- a/public/assets/plan-lab.js
+++ b/public/assets/plan-lab.js
@@ -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: ' + $$(ms[0] || 0) + '. Top 10% of members took ' + (all ? Math.round(100 * top10 / all) : 0) + '% of what members received. Median member: ' + $$(pct(0.5)) + '. Members with nothing: ' + cnt(ms.filter(v => v <= 0).length) + '.
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: ' + $$(ms[0] || 0) + '. Top 10% of members took ' + (all ? Math.round(100 * top10 / all) : 0) + '% of what members received. Median member: ' + $$(pct(0.5)) + '. Members with nothing: ' + cnt(ms.filter(v => v <= 0).length) + ' (most of them joined recently).'
+ + '
Members in for 6 months or more: ' + cnt(older.length) + ', of whom ' + cnt(olderPaid.length) + ' (' + (older.length ? Math.round(100 * olderPaid.length / older.length) : 0) + '%) have been paid; their median is ' + $$(olderMed) + '.'
+ + '
Product without paying: ' + cnt(carried) + ' members hold level 2 or higher purely from licences their team funded; ' + cnt(ownBuy) + ' bought at least one level themselves.'
+ + '
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(); });
diff --git a/public/plan-lab.html b/public/plan-lab.html
index 8440646..ec6b349 100644
--- a/public/plan-lab.html
+++ b/public/plan-lab.html
@@ -240,6 +240,8 @@ details.adv.big summary{font-size:18px}
Unlisted working page for planning. Not a member page, not an offer. Every number here is a mechanic, not a prediction.
- +