1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! # Fitts' Law Spaced Repetition Library
//!
//! A hybrid cognitive model combining:
//! - **SM-2**: Classic spaced repetition algorithm for interval scheduling
//! - **Fitts' Law**: Response time prediction with adaptive calibration
//!
//! ## Key Innovation: Dual Signal Capture
//!
//! Unlike traditional flashcard systems that only capture rating,
//! this library captures **two complementary signals**:
//!
//! | Signal | Type | Source | Purpose |
//! |--------|------|--------|---------|
//! | **Rating** | Subjective | User input | "How well did I recall?" → SM-2 |
//! | **Response Time** | Objective | Measured | "How fast did I recall?" → Fitts calibration |
//!
//! This enables personalized predictions that adapt to each user's patterns.
//!
//! ## Quick Start
//!
//! ```rust
//! use fitts::{FittsScheduler, CardState, Rating, ReviewInput};
//!
//! let mut scheduler = FittsScheduler::new();
//! let card = CardState::default();
//!
//! // Option 1: Rating only (traditional)
//! let result = scheduler.review(card.clone(), Rating::Good);
//!
//! // Option 2: Rating + Response Time (enables calibration)
//! let input = ReviewInput::new(Rating::Good, 2500); // 2.5 seconds
//! let result = scheduler.review(card, input);
//!
//! println!("Next review in {} days", result.card.interval_days);
//! println!("Predicted RT: {:.1}s", result.predicted_rt);
//! if let Some(actual) = result.actual_rt {
//! println!("Actual RT: {:.1}s", actual);
//! }
//! ```
//!
//! ## Adaptive Calibration
//!
//! Based on ACT-R (Anderson, 1993) and Pavlik & Anderson (2008):
//!
//! ```text
//! error = RT_actual - RT_predicted
//! a_new = a + α × error
//! b_new = b + α × error × log₂(ID + 1)
//! ```
//!
//! The model learns each user's response patterns over time.
//!
//! ## Algorithm Details
//!
//! ### SM-2 Algorithm (Wozniak, 1987)
//!
//! Intervals: 1 day → 6 days → previous × EF
//!
//! Rating → Quality mapping:
//! - Again = quality 1 (failure, reset)
//! - Hard = quality 3 (success, maintain)
//! - Good = quality 4 (success, progress)
//! - Easy = quality 5 (success, accelerate)
//!
//! ### Fitts' Law Adaptation
//!
//! Original (1954): RT = a + b × log₂(2D/W)
//!
//! Memory adaptation:
//! - Distance = memory decay (time × difficulty)
//! - Width = accessibility (ease × stability)
//!
//! Formula: RT = a + b × log₂(distance/accessibility + 1)
// Re-export main types
pub use ;
pub use ;
pub use ;