plan-lab: admin fee is a running total from zero; entry fees stated once at the start
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+10
-10
@@ -32,15 +32,15 @@
|
||||
function geometry(){ W = Math.max(1400, GUT + Math.pow(PLAN.w, DEPTHS) * 9 + 30); ROW = (H - TOP - 30) / DEPTHS; svg.setAttribute('viewBox', '0 0 ' + W + ' ' + H); svg.style.minWidth = Math.max(980, Math.round(W * 0.8)) + 'px'; }
|
||||
let quiet = false, tally = null, tallyOrigin = null, licUpFlag = false;
|
||||
// audit: every dollar spent must be received by someone (a position, or 'above'); licences are never money
|
||||
const AUD = { spent: 0, received: 0, above: 0, treasury: 0 };
|
||||
function feeOn(gross){ const f = gross * PLAN.fee; AUD.received += f; AUD.treasury += f; } // the admin wallet's share of a gross price
|
||||
window.reachAudit = () => ({ treasury: Math.round(AUD.treasury * 100) / 100, spent: Math.round(AUD.spent * 100) / 100, received: Math.round(AUD.received * 100) / 100, above: Math.round(AUD.above * 100) / 100, ok: Math.abs(AUD.spent - AUD.received) <= 0.01 + 1e-9 * AUD.spent });
|
||||
const AUD = { spent: 0, received: 0, above: 0, treasury: 0, entryFee: 0 };
|
||||
function feeOn(gross, entry){ const f = gross * PLAN.fee; AUD.received += f; if (entry) AUD.entryFee += f; else AUD.treasury += f; } // the admin wallet's share of a gross price
|
||||
window.reachAudit = () => ({ treasury: Math.round(AUD.treasury * 100) / 100, entryFee: Math.round(AUD.entryFee * 100) / 100, spent: Math.round(AUD.spent * 100) / 100, received: Math.round(AUD.received * 100) / 100, above: Math.round(AUD.above * 100) / 100, ok: Math.abs(AUD.spent - AUD.received) <= 0.01 + 1e-9 * AUD.spent });
|
||||
function tallyFor(d){ return tally[d] || (tally[d] = { n: 0, L: 0, youCash: 0, youLic: 0, above: 0, licUp: 0, cash: {}, lic: {} }); }
|
||||
let nodes = [], byId = {}, you, totals, youLedger = [], nextId = 0;
|
||||
function mkNode(depth, parent, idx){
|
||||
const n = { id: nextId++, depth, parent, idx, children: [], level: 1, directs: 2, get qual(){ return this.directs >= 2; }, cashFrom: 0, cashFromHalf: 0, cash: 0, entry: 0, x: 0, y: 0 };
|
||||
nodes.push(n); byId[n.id] = n;
|
||||
if (parent) { parent.children.push(n); parent.entry += net(1); AUD.spent += price(1); AUD.received += net(1); feeOn(price(1)); if (parent === you) { totals.entry += net(1); } } // Rule 0: the entry pays the upline directly above
|
||||
if (parent) { parent.children.push(n); parent.entry += net(1); AUD.spent += price(1); AUD.received += net(1); feeOn(price(1), true); if (parent === you) { totals.entry += net(1); } } // Rule 0: the entry pays the upline directly above
|
||||
return n;
|
||||
}
|
||||
function layout(){
|
||||
@@ -55,7 +55,7 @@
|
||||
function build(){
|
||||
DEPTHS = DEFD[PLAN.w];
|
||||
geometry();
|
||||
nodes = []; byId = {}; nextId = 0; AUD.spent = 0; AUD.received = 0; AUD.above = 0; AUD.treasury = 0;
|
||||
nodes = []; byId = {}; nextId = 0; AUD.spent = 0; AUD.received = 0; AUD.above = 0; AUD.treasury = 0; AUD.entryFee = 0;
|
||||
totals = { entry: 0, cash: 0, lic: 0, licV: 0, cashN: 0 }; youLedger = [];
|
||||
function mk(depth, parent, idx){
|
||||
const n = mkNode(depth, parent, idx);
|
||||
@@ -386,7 +386,7 @@
|
||||
setV('mLic', totals.lic);
|
||||
const lv = document.getElementById('mLicV'); if (lv) lv.textContent = 'worth ' + $$(totals.licV) + ', paid by your org';
|
||||
setV('mTotal', $$(totals.entry + totals.cash + totals.licV));
|
||||
setV('mFuel', $$(AUD.treasury)); const fs = document.getElementById('mFuelS'); if (fs) fs.textContent = PLAN.fee ? Math.round(PLAN.fee * 100) + '% out of every price; the other ' + Math.round((1 - PLAN.fee) * 100) + '% climbs' : 'no fee: the whole price climbs';
|
||||
setV('mFuel', $$(AUD.treasury)); const fs = document.getElementById('mFuelS'); if (fs) fs.textContent = PLAN.fee ? Math.round(PLAN.fee * 100) + '% of every level bought so far (plus ' + $$(AUD.entryFee) + ' on the entries paid when this org joined)' : 'no fee: the whole price climbs';
|
||||
const ol = document.getElementById('youLedger');
|
||||
if (ol) {
|
||||
ol.innerHTML = '';
|
||||
@@ -476,16 +476,16 @@
|
||||
let dp = null;
|
||||
function deepReset(){
|
||||
const fill = Number(document.getElementById('deepFill').value) / 100, D = PLAN.maxL;
|
||||
dp = { D, levels: [], counts: [], lic: [], licV: [], cash: [], entry: [], pays: [], waves: 0, above: 0, spent: 0, treasury: 0 };
|
||||
window.deepAudit = () => { const rec = dp.cash.reduce((a, b) => a + b, 0) + dp.entry.reduce((a, b) => a + b, 0) + dp.above + dp.treasury; return { spent: Math.round(dp.spent), received: Math.round(rec), ok: Math.abs(dp.spent - rec) <= 1 + 1e-9 * dp.spent }; };
|
||||
dp = { D, levels: [], counts: [], lic: [], licV: [], cash: [], entry: [], pays: [], waves: 0, above: 0, spent: 0, treasury: 0, entryFee: 0 }; // treasury = fee on purchases made in waves; entryFee = fee on the entries paid when the org was built
|
||||
window.deepAudit = () => { const rec = dp.cash.reduce((a, b) => a + b, 0) + dp.entry.reduce((a, b) => a + b, 0) + dp.above + dp.treasury + dp.entryFee; return { spent: Math.round(dp.spent), received: Math.round(rec), ok: Math.abs(dp.spent - rec) <= 1 + 1e-9 * dp.spent }; };
|
||||
for (let d = 0; d <= D; d++) {
|
||||
dp.levels[d] = 1;
|
||||
dp.counts[d] = d === 0 ? 1 : Math.max(1, Math.round(Math.pow(PLAN.w * fill, d)));
|
||||
dp.lic[d] = 0; dp.licV[d] = 0; dp.cash[d] = 0; dp.entry[d] = 0; dp.pays[d] = 0;
|
||||
}
|
||||
for (let d = 1; d <= D; d++) { dp.entry[d - 1] += dp.counts[d] * net(1); dp.spent += dp.counts[d] * price(1); dp.treasury += dp.counts[d] * price(1) * PLAN.fee; } // Rule 0, once, when the org is built
|
||||
for (let d = 1; d <= D; d++) { dp.entry[d - 1] += dp.counts[d] * net(1); dp.spent += dp.counts[d] * price(1); dp.entryFee += dp.counts[d] * price(1) * PLAN.fee; } // Rule 0, once, when the org is built
|
||||
deepRender('Reset. Everyone at level 1, you included; entries paid.');
|
||||
const ol = document.getElementById('deepStory'); if (ol) ol.innerHTML = '<li class="head">Start. You and everyone under you hold level 1. Your ' + cnt(dp.counts[1]) + ' directs paid their entries: <b>' + $$(dp.entry[0]) + '</b> to you after the fee. Press Run one wave.</li>';
|
||||
const ol = document.getElementById('deepStory'); if (ol) ol.innerHTML = '<li class="head">Start. You and everyone under you hold level 1. Your ' + cnt(dp.counts[1]) + ' directs paid their entries: <b>' + $$(dp.entry[0]) + '</b> to you after the fee. (All ' + cnt(dp.counts.reduce((a, b) => a + b, 0) - 1) + ' positions paid an entry when they joined; the admin wallet took ' + $$(dp.entryFee) + ' on those, which is not in the running total below.) Press Run one wave.</li>';
|
||||
}
|
||||
// n payments of `amt` for level L from depth `from`: skip `skipN`, then the gap rule on aggregate levels
|
||||
function deepPay(n, from, L, amt, skipN, rem){
|
||||
|
||||
@@ -187,7 +187,7 @@ details.adv.big summary{font-size:18px}
|
||||
<div><div class="k">Licences funded for you</div><div class="v lic" id="dLic">0</div><div class="s" id="dLicV">worth $0</div></div>
|
||||
<div><div class="k">Waves run</div><div class="v" id="dWaves">0</div><div class="s">one level per position per wave</div></div>
|
||||
<div><div class="k">Went above you</div><div class="v" id="dAbove">$0</div><div class="s">levels that pay uplines higher than you</div></div>
|
||||
<div><div class="k">Admin fee, whole org so far</div><div class="v" id="dFuel">$0</div><div class="s">20% of everything every position under you has spent</div></div>
|
||||
<div><div class="k">Admin fee, running total</div><div class="v" id="dFuel">$0</div><div class="s">20% of every level bought in the waves so far, whole org</div></div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<div class="ctl"><label> </label><button class="primary" id="deepWave">Run one wave</button></div>
|
||||
@@ -244,7 +244,7 @@ details.adv.big summary{font-size:18px}
|
||||
<div class="m"><div class="k">Cash to you</div><div class="v cash" id="mCash">$0</div><div class="s" id="mCashN">0 payments</div></div>
|
||||
<div class="m"><div class="k">Licences funded for you</div><div class="v lic" id="mLic">0</div><div class="s" id="mLicV">worth $0, paid by your org</div></div>
|
||||
<div class="m"><div class="k">Total received</div><div class="v" id="mTotal">$0</div><div class="s">entries + cash + licences</div></div>
|
||||
<div class="m"><div class="k">Admin fee, to the receiver wallet</div><div class="v" id="mFuel">$0</div><div class="s" id="mFuelS">20% out of every price</div></div>
|
||||
<div class="m"><div class="k">Admin fee, running total</div><div class="v" id="mFuel">$0</div><div class="s" id="mFuelS">20% of every level bought so far</div></div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<div class="ctl"><label for="youLevel">Your level (set by hand)</label><input id="youLevel" type="range" min="1" max="8" value="1"><span class="val" id="youLevelVal">1</span></div>
|
||||
@@ -292,6 +292,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=20260927d"></script>
|
||||
<script src="/assets/plan-lab.js?v=20260927e"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user