| 1 | == Creating exercises == |
| 2 | |
| 3 | A Bolt exercise is a PHP script. |
| 4 | Here's an example consisting of a multiple-choice question: |
| 5 | {{{ |
| 6 | <?php |
| 7 | echo 'Conifers are so named because:'; |
| 8 | bolt_exclusive_choice( |
| 9 | array( |
| 10 | 'They carry their seeds in cones.' |
| 11 | 'They are cone-shaped.', |
| 12 | 'They originated during the Coniceous era.', |
| 13 | ), |
| 14 | ); |
| 15 | ?> |
| 16 | }}} |
| 17 | Each time the question is shown, |
| 18 | the choices are shown in a random order. |
| 19 | The correct choice is the first element of the array. |
| 20 | |
| 21 | Here's an example that shows an image; |
| 22 | a correct answer is a click in the indicated subrectangle. |
| 23 | {{{ |
| 24 | <?php |
| 25 | echo "Click on the dog's nose:<p>"; |
| 26 | bolt_image_rect( |
| 27 | 'dog.jpg', |
| 28 | array(100, 60, 110, 70) |
| 29 | ); |
| 30 | ?> |
| 31 | }}} |
| 32 | |
| 33 | Bolt supplies functions for other types of questions, |
| 34 | such as inclusive multiple-choice and fill-in-the-blank. |
| 35 | An exercise can include multiple questions. |
| 36 | |
| 37 | |
| 38 | == Course documents == |
| 39 | |
| 40 | The structure of a Bolt course is defined by a [RFC:4627 JSON] document. |
| 41 | Here's an example of a course with two lessons followed by an exercise: |
| 42 | {{{ |
| 43 | { |
| 44 | "name": "Identifying Sierra Conifers", |
| 45 | "description: "Learn to identify the major conifers of California's Sierra Nevada", |
| 46 | "items": [ |
| 47 | { |
| 48 | "type": "lesson", |
| 49 | "name": "Introduction", |
| 50 | "file": "intro.html" |
| 51 | }, |
| 52 | { |
| 53 | "type": "lesson", |
| 54 | "name": "The Linnaean hierarchy", |
| 55 | "file": "linnaean.html" |
| 56 | }, |
| 57 | { |
| 58 | "type": "exercise", |
| 59 | "file": "linnaean.php" |
| 60 | } |
| 61 | ] |
| 62 | } |
| 63 | }}} |
| 64 | |
| 65 | Course items can be grouped into '''sets'''; for example: |
| 66 | |
| 67 | {{{ |
| 68 | { |
| 69 | "type": "set", |
| 70 | "show_n": 1, |
| 71 | "order": "random", |
| 72 | "items": { |
| 73 | { |
| 74 | ... |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | }}} |
| 79 | |
| 80 | The attributes of a set include: |
| 81 | |
| 82 | * show_n: the number of items in the set to show |
| 83 | * order: whether to show the items sequentially or randomly |
| 84 | |
| 85 | Items (lessons, exercises, and sets) can include '''properties''', e.g.: |
| 86 | |
| 87 | {{{ |
| 88 | { |
| 89 | "type": "lesson", |
| 90 | "name": "The Linnaean hierarchy", |
| 91 | "file": "linnaean.html" |
| 92 | "properties": { |
| 93 | "verbal_level": 12, |
| 94 | "detail_level": 0.8 |
| 95 | } |
| 96 | }, |
| 97 | }}} |
| 98 | |
| 99 | When Bolt has a choice of items (e.g. when it encounters a set from which a |
| 100 | single item is to be shown) it calls, for each item, a course-supplied |
| 101 | '''matchmaking function''', passing to it the student object |
| 102 | (which includes demographics such as age) |
| 103 | and the item's properties (represented as a PHP object). |
| 104 | The matchmaking function returns a number representing the estimated |
| 105 | effectiveness of that item for that student, |
| 106 | and Bolt chooses the item with the highest value. |