Closed baderj closed 3 years ago
Thank you for your detailed report! It's a rare bug so it would have been difficult to find without your debugging.
The simulator takes 'card.left' and then takes the last digit: card.left % 10
This usually returns the amount of learning steps left for a specific card.
However, as you pointed out, this leads to errors when the amount of learning steps is larger than 9. If you'd have 15 learning steps left, then the simulator will only think you'd have 5 left. If you'd have 10 left, then the simulator will think you have 0 left, which will cause a crash.
The solution is to take the last 3 digits instead. This should then be fixed by changing % 10
to % 1000
I will push an update soon!
Version Info
v.1.1.1 of Anki Simulator on Anki 2.1.42 (8eebfe18)
Description
When starting a simulation without changing any options, an exception is thrown:
Probable Cause
Adding additional debugging reveals that the bug affects card in state
CARD_STATE_LEARNING
. Thepercentage_good
list has 11 elements. This matches both the length of theLearning steps
in the GUI and the% correct learnings steps
. However, the variablestep
is 11 and therefore causes theIndexError
.The
step
variable of a card seems to be set in thecollection_simulator.py
as follows:Here again the
number_of_learning_step
is correctly set to 11. But this means that ifcard.left
is a multiple of 10, the the step also turns out to be 11 which causes the index error.