Fix Original consecutive-block penalty off-by-one + standardize run-length stats - #3
Merged
Merged
Conversation
…-length semantics - runCompetition (Original): a fresh winner now starts a run of length 1 (was 0), so the second consecutive block pays 2x per TIP m=2^(r-1) instead of 1x. buildResultObject's recorded multiplier follows suit (2^(consecutive-1), uncapped). - runCompetitionWtema: same counter convention for consistent run stats. - countConsecutiveSameAlgo (baseline): counts run length including the current block; consecutive-runs histogram relabeled to "Run of N".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the same consecutive-block penalty off-by-one already fixed for the New path in #2, now in the Original path, plus standardizes the
consecutivefield to mean run length including the current block on every tab.The bug
TIP-RFC-MT-0004 defines the penalty as
m = 2^(r-1)whereris the block's position in the run (0 = fresh). The Original path applied it one position late:The README always described the correct behavior — the code was lagging by one.
Changes (
js/simulation.js)runCompetition(Original): a fresh winner now starts a run of length 1 (else consecutiveCount = 1, was0), so the block extending a run of lengthkpays2^k=2^(r-1). ✓buildResultObject: recorded multiplier2^max(consecutive-1, 0)(was2^consecutive), uncapped — matches what the Original path actually applied.runCompetitionWtema: same counter convention (reporting only; no penalty) so "Consecutive max" means the same thing on the WTEMA tab.countConsecutiveSameAlgo(baseline tab): run length including the current block;charts.jshistogram relabeled to "Run of N" (a lone block is a run of 1).The New path (
runCompetitionSW, shipped in #2) already uses run-length semantics — no changes there.Verification (VPS, Node v22, real blocks 294400–296521)
Harness T1–T7 all pass:
2^(run length - 1)uncapped; 2nd-in-a-row observed recording 2x; algo switch resets to 1._consecutiveequals the recomputed run length for all 2122 blocks.