我正在尝试使用此链接在php中实现SM2算法 - http://www.blueraja.com/blog/477/a-better-spaced-repetition-learning-algorithm-sm2
我的代码如下 -
<table>
<tr>
<td>Fail </td>
<td>hard </td>
<td>good </td>
<td>easy </td>
</tr>
<tr>
<td>0 </td>
<td>1.5 </td>
<td>2.5 </td>
<td>5 </td>
</tr>
<tr>
<td>
<?php
$performanceRating1 = 0;
$consecutiveCorrectAnswers1 = 0;
echo $easy1 = -0.8 + (0.28 * $performanceRating1) + (0.02 * ($performanceRating1 * $performanceRating1));
?>
</td>
<td><?php
$performanceRating2 = 1.5;
$consecutiveCorrectAnswers2 = 1;
echo $easy2 = -0.8 + (0.28 * $performanceRating2) + (0.02 * ($performanceRating2 * $performanceRating2));
echo "<br>";
echo $nextDueDay2 = 6 * (pow($easy2,($consecutiveCorrectAnswers2 -1)));
//$nextDueDate
?> </td>
<td><?php
$performanceRating3 = 2.5;
$consecutiveCorrectAnswers3 = 1;
echo $easy3 = -0.8 + (0.28 * $performanceRating3) + (0.02 * ($performanceRating3 * $performanceRating3));
echo "<br>";
echo $nextDueDay3 = 6 * (pow($easy3,($consecutiveCorrectAnswers3 -1)));
?> </td>
<td><?php
$performanceRating4 = 5;
$consecutiveCorrectAnswers4 = 1;
echo $easy4 = -0.8 + (0.28 * $performanceRating4) + (0.02 * ($performanceRating4 * $performanceRating4));
echo "<br>";
echo $nextDueDay4 = 6 * (pow($easy4,($consecutiveCorrectAnswers4 -1)));
?> </td>
</tr>
</table>
我得到的输出是 -
Fail Hard good Easy
Performance rating 0 1.5 2.5 5
Easiness -0.8 -0.335 0.025 1.1
Next Due Days 0 6 6 6
我在计算天数时面临问题。在我的代码中,我获得了所有性能等级的类似值,它应该是&lt; 1m&lt; 10m 4d第一次。
您可以了解此现有应用https://apps.ankiweb.net/
的输出结果我希望我能解决我的问题。
感谢。