| 113 | | The script calls Bolt API functions to create a hierarchy of "units" of two types: |
| 114 | | |
| 115 | | * '''Basic units''': lessons and exercises |
| 116 | | * '''Control structures''' representing sets of units, together with rules the govern their use. |
| 117 | | |
| 118 | | The function '''lesson()''' specifies a lesson. |
| 119 | | For example, the following course consists of a single lesson: |
| | 119 | The script calls Bolt API functions to create a hierarchy of '''units'''. |
| | 120 | The API is as follows. |
| | 121 | |
| | 122 | === Lesson === |
| | 123 | |
| | 124 | To specify a lesson: |
| | 125 | {{{ |
| | 126 | lesson( |
| | 127 | filename('lesson_1.php?arg=4'), |
| | 128 | [ title('The ecology of a conifer forest'), ] |
| | 129 | ); |
| | 130 | }}} |
| | 131 | |
| | 132 | The parameters are: |
| | 133 | |
| | 134 | '''filename''' :: the file containing lesson content, optionally followed by a query string. The query string specified in filename() is passed in a global variable '''$bolt_query_string''', rather than in $_GET. To parse it, use |
| | 135 | {{{ |
| | 136 | parse_str($bolt_query_string); |
| | 137 | }}} |
| | 138 | '''title''' :: a name shown to students |
| | 139 | |
| | 140 | === Exercise === |
| | 141 | |
| | 142 | To specify an exercise: |
| | 143 | {{{ |
| | 144 | exercise( |
| | 145 | filename('bolt_sample_exercise1.php') |
| | 146 | [ title('The ecology of a conifer forest'), ] |
| | 147 | ); |
| | 148 | }}} |
| | 149 | |
| | 150 | The filename and title parameters are the same as for '''lesson()'''. |
| | 151 | |
| | 152 | === Sequence === |
| | 153 | |
| | 154 | A 'sequence' unit specifies a set of units that are shown in sequence: |
| | 155 | {{{ |
| | 156 | sequence( |
| | 157 | name('course'), |
| | 158 | unit1, |
| | 159 | unit2, |
| | 160 | ... |
| | 161 | ); |
| | 162 | }}} |
| | 163 | |
| | 164 | === Select === |
| | 165 | |
| | 166 | The '''select''' structure takes a set of units and a 'value function', |
| | 167 | which returns the predicted benefit of showing the unit to the student. |
| | 168 | The unit for which this value is greatest is shown. |
| | 169 | The value function may be partly or entirely random. |
| | 170 | |
| | 171 | This structure can be used to implement |
| | 172 | * "experiments" where different lessons are compared; |
| | 173 | * "adaptive courses" where different lessons are shown to different types of students. |
| | 174 | or a mixture of the two. |
| | 175 | |
| 155 | | There are various control structures; see below. |
| 156 | | The simples one is a 'sequence', |
| 157 | | which specifies a set of units that are shown in sequence. |
| 158 | | Here's an example of a course with two lessons followed by an exercise: |
| 159 | | {{{ |
| 160 | | <?php |
| 161 | | return sequence( |
| 162 | | name('course'), |
| 163 | | lesson(...), |
| 164 | | lesson(...), |
| 165 | | exercise(...) |
| 166 | | ); |
| 167 | | ?> |
| 168 | | }}} |
| | 224 | If 'number()' is given, that many units are shown; the default is to show all the units. |
| | 225 | |
| | 226 | The 'without replacement' applies across multiple visits to the same structure |
| | 227 | (e.g. because of review or refresh). |
| | 228 | |
| | 229 | === Exercise set === |
| | 230 | |
| | 231 | The 'exercise_set' structure specifies a set of exercises and a value 'number' (default one). |
| | 232 | This number of exercises is chosen randomly (without replacement) and administered. |
| | 233 | |
| | 234 | The navigation links on the answer page of the last exercise |
| | 235 | may allow the student to review for and/or repeat the exercise set (see below). |
| | 236 | |
| | 237 | Exercise sets may not be nested. |
| | 238 | |
| | 239 | Example: |
| | 240 | {{{ |
| | 241 | exercise_set( |
| | 242 | name('exer_set'), |
| | 243 | number(1), |
| | 244 | exercise( |
| | 245 | name('exercise 1'), |
| | 246 | filename('file_1.php') |
| | 247 | ), |
| | 248 | exercise( |
| | 249 | name('exercise 1'), |
| | 250 | filename('file_1.php') |
| | 251 | ), |
| | 252 | callback('my_func'), |
| | 253 | repeat(.3, basic_review(), REVIEW), |
| | 254 | repeat(.7, int_review(), REVIEW|REPEAT), |
| | 255 | repeat(1, null, REPEAT|NEXT), |
| | 256 | refresh(array(7, 14, 28)) |
| | 257 | ); |
| | 258 | }}} |
| | 259 | |
| | 260 | '''callback()''' specifies a function to be called when the exercise set is completed. |
| | 261 | This function is called with the following arguments: |
| | 262 | {{{ |
| | 263 | function($student, $score); |
| | 264 | }}} |
| | 265 | where $student is the student record and $score [0..1] is the score. |
| | 266 | == Exercise review and repeat == |
| | 267 | |
| | 268 | The "repeat" items in an exercise set determine the student's options |
| | 269 | to review for and repeat the exercise set. |
| | 270 | ( |
| | 271 | Each repeat item is a function call of the form |
| | 272 | {{{ |
| | 273 | repeat(grade_threshold, review_unit, nav_flags); |
| | 274 | }}} |
| | 275 | The arguments are: |
| | 276 | * grade_threshold: the highest grade to which this item applies |
| | 277 | * review_unit: a unit that reviews the material assessed by for the exercise set. |
| | 278 | * nav_flags: a bitmask determining which navigation options will be presented: |
| | 279 | * REVIEW: show the review units, then repeat the exercise set |
| | 280 | * REPEAT: repeat exercise set immediately |
| | 281 | * NEXT: continue without repeating the exercise set |
| | 282 | |
| | 283 | A student's score on an exercise set is the average score of the selected exercises. |
| | 284 | Call this Y; |
| | 285 | the "selected repeat item" is the one with the least X such that Y < X. |
| | 286 | |
| | 287 | If there is no such repeat item, the student is not given an option |
| | 288 | to repeat the exercise set; i.e., they see only a Next button. |
| | 289 | |
| | 290 | Otherwise let R be the selected repeat item. |
| | 291 | If R.repeat_optional is true, a Next button is shown. |
| | 292 | If R.review_optional is true, a "Repeat" button is shown. |
| | 293 | If R.review_unit is present, a "Review" button is shown. |
| | 294 | |
| | 295 | Thus, in the example above, the student's options are: |
| | 296 | |
| | 297 | || grade || options || |
| | 298 | || [0, .3) || review and repeat exercise || |
| | 299 | || [.3, .7) || review and repeat exercise, or repeat exercise || |
| | 300 | || [.7, 1) || repeat exercise, or continue || |
| | 301 | || 1 || continue || |
| | 302 | |
| | 303 | == Memory refresh == |
| | 304 | |
| | 305 | If a '''refresh()''' argument is given to exercise_set(), |
| | 306 | then when the set is completed by a student it is added to |
| | 307 | a "refresh schedule". |
| | 308 | Each element in a refresh schedule specifies |
| | 309 | The intervals (in days) are given as arguments to refresh(). |
| | 310 | |
| | 311 | At a given point, one or more exercise sets may be due for refresh. |
| | 312 | The student may choose any of them to view. |
| | 313 | Bolt keeps track of the state independently for each set; |
| | 314 | the student may begin refresh for set A while |
| | 315 | partway through refresh for set B. |
| 270 | | == Control structures == |
| 271 | | === Sequences === |
| 272 | | |
| 273 | | Sequences were described above. |
| 274 | | |
| 275 | | === Select === |
| 276 | | |
| 277 | | The '''select''' structure takes a set of units and a 'value function', |
| 278 | | which returns the predicted benefit of showing the unit to the student. |
| 279 | | The unit for which this value is greatest is shown. |
| 280 | | The value function may be partly or entirely random. |
| 281 | | |
| 282 | | This structure can be used to implement |
| 283 | | * "experiments" where different lessons are compared; |
| 284 | | * "adaptive courses" where different lessons are shown to different types of students. |
| 285 | | or a mixture of the two. |
| 286 | | |
| 287 | | {{{ |
| 288 | | <?php |
| 289 | | function value($student, $unit) { |
| 290 | | return abs($student->verbal_level - $unit->verbal_level); |
| 291 | | } |
| 292 | | |
| 293 | | return select( |
| 294 | | name('course'), |
| 295 | | valuator('value'), |
| 296 | | lesson( |
| 297 | | name('lesson 1'), |
| 298 | | filename('bolt_sample_lesson1.php') |
| 299 | | ), |
| 300 | | lesson( |
| 301 | | name('lesson 2'), |
| 302 | | filename('bolt_sample_lesson2.php') |
| 303 | | ), |
| 304 | | ); |
| 305 | | ?> |
| 306 | | }}} |
| 307 | | |
| 308 | | |
| 309 | | === Random === |
| 310 | | |
| 311 | | The '''random''' control structure selects randomly (without replacement) from a set of units. |
| 312 | | {{{ |
| 313 | | <?php |
| 314 | | return random( |
| 315 | | name('foobar'), |
| 316 | | number(2), |
| 317 | | lesson( |
| 318 | | name('lesson 1'), |
| 319 | | filename('bolt_sample_lesson1.php') |
| 320 | | ), |
| 321 | | lesson( |
| 322 | | name('lesson 2'), |
| 323 | | filename('bolt_sample_lesson2.php') |
| 324 | | ), |
| 325 | | lesson( |
| 326 | | name('lesson 3'), |
| 327 | | filename('bolt_sample_lesson3.php') |
| 328 | | ), |
| 329 | | ); |
| 330 | | ?> |
| 331 | | }}} |
| 332 | | |
| 333 | | If 'number()' is given, that many units are shown; the default is to show all the units. |
| 334 | | |
| 335 | | The 'without replacement' applies across multiple visits to the same structure |
| 336 | | (e.g. because of review or refresh). |
| 337 | | |
| 338 | | === Exercise set === |
| 339 | | |
| 340 | | The 'exercise_set' structure specifies a set of exercises and a value 'number' (default one). |
| 341 | | This number of exercises is chosen randomly (without replacement) and administered. |
| 342 | | |
| 343 | | The navigation links on the answer page of the last exercise |
| 344 | | may allow the student to review for and/or repeat the exercise set (see below). |
| 345 | | |
| 346 | | Exercise sets may not be nested. |
| 347 | | |
| 348 | | Example: |
| 349 | | {{{ |
| 350 | | exercise_set( |
| 351 | | name('exer_set'), |
| 352 | | number(1), |
| 353 | | exercise( |
| 354 | | name('exercise 1'), |
| 355 | | filename('file_1.php') |
| 356 | | ), |
| 357 | | exercise( |
| 358 | | name('exercise 1'), |
| 359 | | filename('file_1.php') |
| 360 | | ), |
| 361 | | callback('my_func'), |
| 362 | | repeat(.3, basic_review(), REVIEW), |
| 363 | | repeat(.7, int_review(), REVIEW|REPEAT), |
| 364 | | repeat(1, null, REPEAT|NEXT), |
| 365 | | refresh(array(7, 14, 28)) |
| 366 | | ); |
| 367 | | }}} |
| 368 | | |
| 369 | | '''callback()''' specifies a function to be called when the exercise set is completed. |
| 370 | | This function is called with the following arguments: |
| 371 | | {{{ |
| 372 | | function($student, $score); |
| 373 | | }}} |
| 374 | | where $student is the student record and $score [0..1] is the score. |
| 375 | | == Exercise review and repeat == |
| 376 | | |
| 377 | | The "repeat" items in an exercise set determine the student's options |
| 378 | | to review for and repeat the exercise set. |
| 379 | | ( |
| 380 | | Each repeat item is a function call of the form |
| 381 | | {{{ |
| 382 | | repeat(grade_threshold, review_unit, nav_flags); |
| 383 | | }}} |
| 384 | | The arguments are: |
| 385 | | * grade_threshold: the highest grade to which this item applies |
| 386 | | * review_unit: a unit that reviews the material assessed by for the exercise set. |
| 387 | | * nav_flags: a bitmask determining which navigation options will be presented: |
| 388 | | * REVIEW: show the review units, then repeat the exercise set |
| 389 | | * REPEAT: repeat exercise set immediately |
| 390 | | * NEXT: continue without repeating the exercise set |
| 391 | | |
| 392 | | A student's score on an exercise set is the average score of the selected exercises. |
| 393 | | Call this Y; |
| 394 | | the "selected repeat item" is the one with the least X such that Y < X. |
| 395 | | |
| 396 | | If there is no such repeat item, the student is not given an option |
| 397 | | to repeat the exercise set; i.e., they see only a Next button. |
| 398 | | |
| 399 | | Otherwise let R be the selected repeat item. |
| 400 | | If R.repeat_optional is true, a Next button is shown. |
| 401 | | If R.review_optional is true, a "Repeat" button is shown. |
| 402 | | If R.review_unit is present, a "Review" button is shown. |
| 403 | | |
| 404 | | Thus, in the example above, the student's options are: |
| 405 | | |
| 406 | | || grade || options || |
| 407 | | || [0, .3) || review and repeat exercise || |
| 408 | | || [.3, .7) || review and repeat exercise, or repeat exercise || |
| 409 | | || [.7, 1) || repeat exercise, or continue || |
| 410 | | || 1 || continue || |
| 411 | | |
| 412 | | == Memory refresh == |
| 413 | | |
| 414 | | If a '''refresh()''' argument is given to exercise_set(), |
| 415 | | then when the set is completed by a student it is added to |
| 416 | | a "refresh schedule". |
| 417 | | Each element in a refresh schedule specifies |
| 418 | | The intervals (in days) are given as arguments to refresh(). |
| 419 | | |
| 420 | | At a given point, one or more exercise sets may be due for refresh. |
| 421 | | The student may choose any of them to view. |
| 422 | | Bolt keeps track of the state independently for each set; |
| 423 | | the student may begin refresh for set A while |
| 424 | | partway through refresh for set B. |
| | 417 | |