Implementing the SM-2 Algorithm in Rust: An Improved Spaced Repetition System

2024-12-27

The author implemented the SuperMemo SM-2 algorithm, a modified version used in the spaced repetition software Mochi, in Rust. This algorithm dynamically adjusts review intervals based on user performance ratings to optimize learning efficiency. The article details the algorithm's mechanics, including the calculation of the ease factor (EF), determining review intervals, and how user ratings affect algorithm parameters. Rust code is provided with explanations of key design choices.