← Back to App

Spaced Repetition Algorithm

Overview

🧠
What is Spaced Repetition?
A learning technique that shows you cards just before you forget them. Instead of cramming, you review at optimal intervals for long-term memory.
📈
How It Works
Each time you get a card right, the wait time before the next review gets longer:
1 min → 10 min → 1 hour → 1 day → 3 days → ...
🔄
What If You Forget?
No problem! If you get a card wrong, it resets to 1 minute. You'll see it again soon and build up the intervals fresh.
Wrong answer → Back to 1 min → Start again
âš¡
Smart Adaptation
The app tracks how fast you answer and if you need hints. Quick, confident answers? You'll skip ahead. Need help? More practice.
Fast & correct = +2 levels Used hint = stay same
🎯
The Result
You spend less time on easy cards and more time on hard ones. Once you hit 3+ days interval, a card is considered "mastered"!
Level 4+ = Mastered ✓

This app uses a simplified spaced repetition system inspired by SM-2. Cards are scheduled for review at increasing intervals based on successful recall.

Interval Levels

There are 10 interval levels (0-9):

LevelIntervalDescription
01 minuteInitial / Reset after wrong answer
110 minutesFirst success
21 hourSecond success
31 dayThird success
43 daysFourth success (considered "mastered")
57 daysFifth success
614 daysSixth success
730 daysLong-term retention
860 daysExtended retention
990 daysMaximum interval

Scheduling Logic

On Correct Answer

  1. Increment successCount
  2. Advance intervalIndex by 1 (max 9)
  3. Set nextReview = now + interval for new level

Note: With adaptive difficulty, fast responses advance by +2 levels, and hint usage prevents advancement.

On Wrong Answer

  1. Increment failCount
  2. Reset intervalIndex to 0
  3. Set nextReview = now + 1 minute

Card Selection Priority

Cards are selected for review using the "Review First, Learn Second" principle:

Priority 1: Past Due Reviews

Cards where nextReview > 0 AND nextReview <= now

Why first? These cards have been started but need review. Missing reviews wastes previous learning effort and causes forgetting. Spaced repetition ONLY works if you review before forgetting.

Selection: Same-session wrong cards first (if any are due), then random from remaining past due reviews.

Same-session preference: Cards answered wrong earlier in this session get priority when they become due again. This reinforces corrections while the context is fresh, without bypassing SRS intervals — the 1-minute wait still applies.

Priority 2: New Cards

Cards where nextReview === 0 (never attempted)

Why second? Expand vocabulary only after clearing reviews. Prevents the "perpetual beginner" problem of surface-level exposure without mastery.

Selection: Random from all new cards

Priority 3: Upcoming Reviews

Cards where nextReview > now (future reviews)

Why last? These aren't due yet. Only shown when no past due or new cards remain.

Selection: Soonest due card first

This follows proven SRS best practices used by Anki and SuperMemo. Reviews always take precedence over new material to ensure retention and prevent review backlog.

Separate Tracking for Read/Write

Each card has independent progress for READ and WRITE modes:

progress[word] = {
  read: {
    intervalIndex: 0,      // Current level (0-9)
    nextReview: timestamp, // When card is due
    successCount: 0,       // Total correct answers
    failCount: 0,          // Total wrong answers
    lapseCount: 0,         // Times failed after reaching level 2+
    avgResponseTime: null, // Rolling average response time (ms)
    difficultyScore: 1.0   // Card difficulty (0.5-2.0)
  },
  write: {
    intervalIndex: 0,
    nextReview: timestamp,
    successCount: 0,
    failCount: 0,
    lapseCount: 0,
    avgResponseTime: null,
    difficultyScore: 1.0
  }
}

This means:

"Mastered" Definition

A card is considered "mastered" when intervalIndex >= 4 (3+ days interval). This is displayed in the homepage stats.

Progressive Difficulty (Hint Removal)

As you progress with a card, hints are gradually removed to ensure true recall:

LevelREAD ModeWRITE Mode
0-1"Show hanyupinyin" button available"Show hint" button available
2+No pinyin hint — must recall pronunciationNo hint button — must recall characters

Why? At levels 0-1, you're still learning the card and hints help reinforce memory. By level 2, you've succeeded twice — now it's time to prove you can recall without aids. If you fail at level 2+, you reset to level 0 and hints become available again.

Initial State

For new cards (no progress data):

Adaptive Difficulty System

Beyond simple correct/wrong tracking, the app measures implicit difficulty signals to adapt intervals per-card. This provides gradation without requiring extra button clicks.

Difficulty Signals

Three implicit signals determine how well you know a card:

SignalWhat It MeasuresHow It's Captured
Response Time Speed of recall — fast = strong memory Timer from card display to answer
Hint Usage Whether you needed help to recall "Show pinyin" / "Show hint" button clicks
Outcome Whether you got it right Correct / Wrong answer

The Eight Scenarios

Combining these signals creates a spectrum of memory strength:

TimeHintResultInterpretationInterval Adjustment
FastNoCorrect Strong recall — truly mastered +2 levels (skip ahead)
SlowNoCorrect Weak but recalled — needs reinforcement +1 level (normal)
FastYesCorrect Recognized after hint — partial knowledge +0 levels (stay same)
SlowYesCorrect Struggled even with hint — barely known +0 levels, mark struggling
FastNoWrong Complete blank — not learned Reset to 0
SlowNoWrong Tried but failed — interference or decay Reset to 0
FastYesWrong Hint didn't help — never learned properly Reset to 0, mark struggling
SlowYesWrong Struggled and failed — potential leech Reset to 0, increment leech counter

Response Time Measurement

READ Mode

WRITE Mode

Adaptive Thresholds

What counts as "fast" or "slow" adapts to each user:

// Per-user rolling average (updated each review)
avgResponseTime = avgResponseTime * 0.8 + thisResponseTime * 0.2

// Thresholds relative to user's average
FAST = responseTime < avgResponseTime * 0.7   // 30% faster than usual
SLOW = responseTime > avgResponseTime * 1.5   // 50% slower than usual

Why adaptive? A 5-second response might be fast for a complex sentence but slow for a simple word. User-relative thresholds account for individual pace and card complexity.

Hint Usage Impact

Using a hint indicates incomplete recall, even if you get the answer right:

Hint ButtonModeImpact on "Correct" Answer
"Show hanyupinyin" READ Correct with hint — don't advance interval
"Show hint" (blur) WRITE Correct with hint — don't advance interval
"Show English" READ No penalty (translation lookup is acceptable)

Key insight: If you needed the pinyin hint to pronounce it, or needed to peek at the characters to write them, you haven't truly memorized the card yet. The interval should stay the same rather than advance.

How It Works

Each card tracks a difficulty score (0.5 to 2.0) that adjusts intervals:

Example: A 7-day base interval becomes 14 days for an easy card (score 0.5) or 3.5 days for a hard card (score 2.0).

Quick Reference: Outcome Matrix

Scenario Level Change Difficulty Change
Fast + No hint + Correct +2 levels (skip ahead) × 0.9 (easier)
Normal + No hint + Correct +1 level No change
Slow + No hint + Correct +1 level × 1.05 (slightly harder)
Any + Hint + Correct +0 levels (stay same) × 1.1 (harder)
Any + Any + Wrong Reset to 0 × 1.2 (harder)

For implementation details, see Developer Guide: Adaptive Difficulty Implementation.

Leech Detection

A "leech" is a card that consumes review time without being learned. These cards need special attention.

Leech Criteria

A card is flagged as a leech when either:

Leech Indicators Planned

Leech cards will be marked with visual indicators:

Leech Recovery Strategies Planned

When a card is flagged as a leech, suggested actions:

  1. Mnemonic prompt: "This card is tricky. Try creating a memory story!"
  2. Related words: Show similar characters or compounds for context
  3. Temporary suspension: Option to pause card and revisit later
  4. Forced slow review: Require hint usage to rebuild foundation

For implementation details, see Developer Guide: Leech Detection.

Summary: The Complete Picture

The adaptive system creates a virtuous cycle:

  1. Easy cards (fast, no hints) → lower difficulty score → longer intervals → less time spent
  2. Hard cards (slow, hints needed) → higher difficulty score → shorter intervals → more practice
  3. Leech cards (repeated failures) → flagged for attention → targeted intervention

This means your study time automatically focuses on cards that need it most, without requiring you to manually rate difficulty.