Project

sm2_rb

0.0
Low commit activity in last 3 years
No release in over a year
SuperMemo 2 algorithm implementation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.7, >= 3.7.0
 Project Readme

This is a Ruby implementation of the SuperMemo 2 algorithm.

Install

gem install sm2_rb

Or add it to your Gemfile

gem 'sm2_rb', '~> 0.0.1'

Usage

Create a new fact and call .next_interval, passing the grade to the method. Valid grades are 0-5, where 0 is it was really hard to answer, and 5 is it was very easy to answer. Returns the interval where it should be shown next.

fact = Sm2::Fact.new
fact.next_interval(5) => 1

The fact keeps track of what repetition it's on, along with its easiness factor and current interval. If you have a fact with these three attributes stored, you can initialize with these values:

fact = Sm2::Fact.new(
  easiness_factor: 2.6,
  repetition: 2,
  interval: 6
)

License

This gem is released under the MIT License.