binary sm2

by Timar

HTML

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chartist.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chartist-plugin-axistitle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chartist-plugin-pointlabels.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.27.0/ramda.min.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.css">
    <div id="all-charts" class="chart-container">

    </div>

CSS

.chart-container {
  width: 950px;
  margin: auto;
}
.ct-series-a .ct-line, .ct-series-a .ct-point {
  stroke: yellow !important;
}
.ct-series-b .ct-line, .ct-series-b .ct-point {
  stroke: orange !important;
}
.ct-series-c .ct-line, .ct-series-c .ct-point {
  stroke: red !important;
}
.ct-series-d .ct-line, .ct-series-d .ct-point {
  stroke: purple !important;
}

JavaScript

// https://cdn.jsdelivr.net/gh/eu81273/jsfiddle-console/console.js


// TODO: if correct answer very fast, boost easiness!
// TODO: if wrong answer partially correct, increase reviewQuality!
// TODO: only allow specific amount of cards to be active at one time. this hsould of course also adjust based on the user.
//       Maybe check the ratio of consecutiveCorrect new Cards. if all new cards have a 'positive ratio', than new cards are accepable,
//       since the user is doing well on consective tests. if consectuvie correct has a bad ratio across all new words, focus on repetition of new words.
//       pseudo: var amountOFNewCardsPossible =  count(newCards).with('consecutive correct > 3') / count(newCards).with('totalwrong' > 3)
//       should result in a number of newCards and if new Cards are being still introduced.

//TODO: Premature review: New interval should be: (last review + days since) * easinessfactor , Easinessfactor should be increased by root distance to target reviewDate ie. if target review was 10Days, but has been reviewed prematurely after 1 day. Distance = (1/10)**2
// Easiness = easiness + (FormulaResult) * Distance

/*
Glossary:
New Card/Word: A word that has been newly introduced and is not yet matured. The unit for the interval timer is minutes.

Mature Card/Word: A card that has been correctly answered {newWordCutoff} many times, and is no longer a "New Card". This changes the Interval unit to days instead of minutes.


*/

const CFS = {
  // how many consecutive correct answers does it take to mature a card
  newWordCutoff: 5
}

class Word {
  constructor(word) {
    this.word = word;
    this.easiness = 2.5;
    this.consecutiveCorrectAnswers = 0;
    this.totalCorrectAnswers = 0;
    this.totalWrongAnswers = 0;
    this.totalAnswers = 0;
    this.firstRevision = undefined;
    this.lastRevisionDate = 0;
    this.revisionInterval = 0
    this.nextRevisionDate = 0;
    this.isNewWord = true
  }
}

const cloneObj = (obj)=>...