Skip to content

gmp26/qalib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qalib

A commonjs library which generates sixth-form (grade 12) mathematical fluency exercise questions with answers. The output is in HTML/MathJAX.

This is the library that generates questions and answers, extracted from mathmo in Apps1. The original had a large number of global variables which have been eliminated and the library has been converted to the CommonJS standard to handle dependencies between its components using browserify. It will now work in the browser or in a nodeJS environment.

Installation

For browser use, include dist/qalib.js.

For node, add dist/qalib.js to your project and then require it.

Use in a NodeJS project

  var qalib = require('<path_to>/qalib.js')({});
  ...

Use in the browser

See the examples folder.

<script src="../dist/qalib.js" type="text/javascript"></script>
<script>
  var qalib = require('qalib')({});

  // Initialise the seed - anything will do.
  // This just corresponds to the seed used in unit tests.
  var seed = "unit-test/C38/1";

  // qalib includes seedrandom for repeatable questions
  Math.seedrandom(seed);
  maker = qalib.topicMakerById('C38');

  for(var i = 1; i < 4; i++) {
    qa = maker();
    alert("question " + i + " = "+qa[0]);
    alert("answer " + i + " = " + qa[1]);
  }
</script>

Development

To install and run unit tests continuously:-

git clone https://github.com/gmp26/qalib.git
cd qalib
npm install
grunt 

About

A commonjs library which generates sixth-form (K12) mathematical fluency exercise questions with answers. The output is in HTML/MathJAX.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors