Skip to content

Implement index progression calculation and UI improvements#136

Draft
Copilot wants to merge 6 commits intoindex-progressionfrom
copilot/fix-index-progression-calculation
Draft

Implement index progression calculation and UI improvements#136
Copilot wants to merge 6 commits intoindex-progressionfrom
copilot/fix-index-progression-calculation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 15, 2026

The index stat (fkdr² × stars) was not implemented, causing 13 test failures. Index progression is complex because both fkdr and stars change over time, creating a cubic equation with potentially multiple roots.

Implementation

  • Cubic solver: Cardano's formula handling all cases (3/1/0 real roots, degenerate quadratic/linear)
  • Multi-root filtering: Find all crossings, select earliest where d(index)/dt matches trend direction
  • Derivative-based trending: Calculate d(index)/dt = starsPerDay × fkdr² + 2 × stars × fkdr × d(fkdr)/dt to determine if index is increasing/decreasing
  • Adaptive stars calculation: Use PRESTIGE_EXP/200 divisor for low exp rates (<300/day) to account for early prestige level costs (500/1000/2000/3500 vs 5000)
  • Magnitude-based milestones: Special handling at power-of-10 boundaries (e.g., index=100 trending down → milestone=90, not 0)

Example

// Solve: index(t) = (s₀ + s×t) × (k₀ + k×t)² / (d₀ + d×t)² = M
// Expands to: a×t³ + b×t² + c×t + d = 0
const allRoots = solveCubicAllRoots(a, b, c, d);

// Filter for crossings matching trend direction
const validRoots = allRoots.filter(t => {
    const indexRate_t = /* derivative at time t */;
    return trendingUpward ? indexRate_t > -ε : indexRate_t < ε;
});

return validRoots[0]; // Earliest valid crossing

Test fixes

  • Fixed "no progress" test data (experience 500→7000 for 4 stars)
  • Added Infinity handling in float comparisons (Math.abs(Infinity - Infinity) is NaN)

UI Improvements

  • Conditional decimal rendering: Index values display 1 decimal place when < 1 (e.g., "0.1"), and no decimals when ≥ 1 (e.g., "199,759")

  • Progress breakdown display: Implemented detailed progress per day breakdown showing:

    • Overall progress per day
    • Stars per day
    • Long-time FKDR
    • Finals per day
    • Final deaths per day

    Example: 114.19/day (0.60 stars/day, 13.91 long-time FKDR, 33.45 finals/day, 2.41 final deaths/day)

Screenshot

Index progression display showing new decimal rendering and progress breakdown:

Index progression display

Original prompt

Implement index progression calculation. The tests are currently failing. The implementation should ensure all the currently failing tests pass


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Jan 15, 2026

Deploying rainbow with  Cloudflare Pages  Cloudflare Pages

Latest commit: eaf01ae
Status: ✅  Deploy successful!
Preview URL: https://7494635a.rainbow-ctx.pages.dev
Branch Preview URL: https://copilot-fix-index-progressio.rainbow-ctx.pages.dev

View logs

Copilot AI changed the title [WIP] Fix index progression calculation implementation to pass tests Implement index progression calculation Jan 15, 2026
Copilot AI requested a review from Amund211 January 15, 2026 22:49
@Amund211 Amund211 force-pushed the index-progression branch 3 times, most recently from 577be0b to 221ad50 Compare January 17, 2026 13:03
Copilot AI and others added 5 commits January 17, 2026 14:03
Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
@Amund211 Amund211 force-pushed the copilot/fix-index-progression-calculation branch from 6870934 to 12ec583 Compare January 17, 2026 13:03
@Amund211
Copy link
Copy Markdown
Owner

@copilot Fix the rendering so that we don't display fractions in the index unless you have < 1 index, in which case we can show 1 fractional digit. Fix the TODO on the right to display progress per day broken down including actual progress, stars per day, long-time fkdr finals per day and final deaths per day. (just like the fkdr display only including stars per day as well

e.g.
-0,00/day (0,1 stars/day, 8,21 long-time FKDR, 0,32 finals/day, 0,04 final deaths/day)

Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 17, 2026

@copilot Fix the rendering so that we don't display fractions in the index unless you have < 1 index, in which case we can show 1 fractional digit. Fix the TODO on the right to display progress per da...

Fixed in commit eaf01ae. The index stat now:

  1. Shows no decimals when ≥ 1, and 1 decimal place when < 1 (e.g., "0.1" vs "588")
  2. Displays detailed progress breakdown: "114.19/day (0.60 stars/day, 13.91 long-time FKDR, 33.45 finals/day, 2.41 final deaths/day)"

Screenshot showing AlgaeBluwum's index progression with the new functionality:
Index progression display

Copilot AI changed the title Implement index progression calculation Implement index progression calculation and UI improvements Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants