Skip to content

Instantly share code, notes, and snippets.

@andymatuschak
Last active October 29, 2023 13:31
Show Gist options
  • Save andymatuschak/ac29317253b4b0f5e7c68357cfb755b2 to your computer and use it in GitHub Desktop.
Save andymatuschak/ac29317253b4b0f5e7c68357cfb755b2 to your computer and use it in GitHub Desktop.
const p = 0.9;
const np = 1 - p;
const newCards = 15;
const ease = 2.5;
const max = 1200;
const secondsPerCard = 6;
const queue = [{baseDays: 5, factor: 1}];
let total = 0;
while (queue.length > 0) {
const {baseDays, factor} = queue.shift();
if (baseDays > max || factor < 0.0001) {
continue;
}
total += factor;
queue.push({baseDays: baseDays * ease, factor: factor * p}, {baseDays: Math.max(5, baseDays / ease), factor: factor * np});
}
const totalCards = total * newCards;
console.log(`Total cards to review: ${totalCards}. Review time: ${totalCards * secondsPerCard / 60}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment