SHOW:
|
|
- or go back to the newest paste.
1 | %% Anki scheduler simulation by Jantek Mikulski | |
2 | ||
3 | % Card's structure | |
4 | dueDate = 1; | |
5 | daysInterval = 2; | |
6 | ease = 3; | |
7 | ||
8 | cards = [1 1 2.5]; %initial card | |
9 | maxSimTime = 100*365; %maximal simulation time | |
10 | dueTable = zeros(maxSimTime, 1); | |
11 | today = 0; %today date | |
12 | - | numberOfCards = 0; % number of total cards |
12 | + | numberOfCards = 1; % number of total cards |
13 | %% | |
14 | startingEase = 2.5; | |
15 | easyBonus = 1.2; | |
16 | newCardsDaily = 10; % number of new cards each day | |
17 | endDate = 15*365; % for how many days should the simulation be run | |
18 | goodPercentage = 0.65; | |
19 | easyPercentage = 0.1; | |
20 | hardPercentage = 0.2; %the rest if forgotten | |
21 | newIntervalOnLapses = 0.1; | |
22 | while today < endDate | |
23 | % reviewing existing cards | |
24 | for N=1:numberOfCards | |
25 | if cards(N, dueDate) == today | |
26 | r = rand(); | |
27 | if r < goodPercentage % good on card | |
28 | cards(N, daysInterval) = floor(cards(N, daysInterval)*cards(N, ease)); | |
29 | cards(N, dueDate) = today+cards(N, daysInterval); | |
30 | elseif r < goodPercentage + easyPercentage % easy on card | |
31 | cards(N, daysInterval) = floor(cards(N, daysInterval)*cards(N, ease)*easyBonus); | |
32 | cards(N, dueDate) = today+cards(N, daysInterval); | |
33 | cards(N, ease) = cards(N, ease) + 0.15; | |
34 | elseif r < goodPercentage + easyPercentage + hardPercentage % hard on card | |
35 | cards(N, daysInterval) = floor(cards(N, daysInterval)*1.2); | |
36 | cards(N, dueDate) = today+cards(N, daysInterval); | |
37 | cards(N, ease) = max(1.3, cards(N, ease)-0.15); | |
38 | else % card forgotten (again) | |
39 | cards(N, daysInterval) = max(1, floor(cards(N, daysInterval)*newIntervalOnLapses)); | |
40 | cards(N, dueDate) = today+cards(N, daysInterval); | |
41 | cards(N, ease) = max(1.3, cards(N, ease)-0.20); | |
42 | end | |
43 | dueTable(today+cards(N, daysInterval))=dueTable(today+cards(N, daysInterval))+1; | |
44 | end | |
45 | end | |
46 | %adding new cards | |
47 | for N=1:newCardsDaily | |
48 | cards = [cards; [today+1 1 startingEase]]; | |
49 | numberOfCards = numberOfCards+1; | |
50 | end | |
51 | today = today + 1; | |
52 | end | |
53 | ||
54 | plot(dueTable(1:endDate+30)); |