Spaces:
Running
Running
Clarify quiz feedback and stride input
Browse files
app.js
CHANGED
|
@@ -57,11 +57,12 @@ function choose(item, choice, index) {
|
|
| 57 |
const detail = mismatch || runTest(item, item.choices[correctIndex]);
|
| 58 |
const lead = mismatch ? 'Caught it.' : 'Still green.';
|
| 59 |
const evidence = `At index ${detail.index}, the reference returns ${displayValue(detail.expected)}; the candidate returns ${displayValue(detail.observed)}.`;
|
| 60 |
-
const alternative = mismatch ? '' : ` Try ${item.choices[correctIndex].label.toLowerCase()}.`;
|
| 61 |
feedback.className = `feedback ${mismatch ? 'caught' : 'missed'}`;
|
| 62 |
feedback.innerHTML = '<strong></strong><p></p><p></p>';
|
| 63 |
feedback.children[0].textContent = lead;
|
| 64 |
-
feedback.children[1].textContent =
|
|
|
|
|
|
|
| 65 |
feedback.children[2].textContent = item.lesson;
|
| 66 |
feedback.hidden = false;
|
| 67 |
byId('score').textContent = `Caught: ${score}`;
|
|
|
|
| 57 |
const detail = mismatch || runTest(item, item.choices[correctIndex]);
|
| 58 |
const lead = mismatch ? 'Caught it.' : 'Still green.';
|
| 59 |
const evidence = `At index ${detail.index}, the reference returns ${displayValue(detail.expected)}; the candidate returns ${displayValue(detail.observed)}.`;
|
|
|
|
| 60 |
feedback.className = `feedback ${mismatch ? 'caught' : 'missed'}`;
|
| 61 |
feedback.innerHTML = '<strong></strong><p></p><p></p>';
|
| 62 |
feedback.children[0].textContent = lead;
|
| 63 |
+
feedback.children[1].textContent = mismatch
|
| 64 |
+
? evidence
|
| 65 |
+
: `Your chosen test matches the reference. Try ${item.choices[correctIndex].label.toLowerCase()}: ${evidence}`;
|
| 66 |
feedback.children[2].textContent = item.lesson;
|
| 67 |
feedback.hidden = false;
|
| 68 |
byId('score').textContent = `Caught: ${score}`;
|
cases.mjs
CHANGED
|
@@ -28,7 +28,7 @@ export const cases = [
|
|
| 28 |
{
|
| 29 |
slug: 'row-stride',
|
| 30 |
title: 'The wrong row stride',
|
| 31 |
-
task: 'Triple every value in a 2D view.',
|
| 32 |
fixed: '4 by 3 contiguous view, all values checked',
|
| 33 |
code: `for (row = 0; row < height; row++)
|
| 34 |
for (col = 0; col < width; col++)
|
|
|
|
| 28 |
{
|
| 29 |
slug: 'row-stride',
|
| 30 |
title: 'The wrong row stride',
|
| 31 |
+
task: 'Triple every value in a 2D view of a backing buffer numbered 0, 1, 2, ...',
|
| 32 |
fixed: '4 by 3 contiguous view, all values checked',
|
| 33 |
code: `for (row = 0; row < height; row++)
|
| 34 |
for (col = 0; col < width; col++)
|