Skip to content

An implementation of the SuperMemo 2 algorithm in ruby

License

Notifications You must be signed in to change notification settings

getabetterpic/sm2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An implementation of the SuperMemo 2 algorithm in ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages