Open week07-methods/rt.html and turn it into the task
your Methods describes. The pieces you need:
// (a) colours, words, and keys at the top
const colours = [
{ name: "RED", key: "z", rgb: [230, 70, 60] },
{ name: "BLUE", key: "x", rgb: [80, 140, 255] },
// ...
];
// (b) a shuffled list of trials, half congruent, half incongruent
trials.push({ condition: "congruent", word: ink.name, ink: ink });
trials.push({ condition: "incongruent", word: other.name, ink: ink });
trials = shuffle(trials);
// (c) in draw(): show the word in the ink colour instead of the square
fill(current.ink.rgb[0], current.ink.rgb[1], current.ink.rgb[2]);
text(current.word, width / 2, height / 2);
// (d) in keyPressed(): send z/x/n/m to handleResponse(k),
// and work out correct = (k === current.ink.key) ? 1 : 0
// (e) add condition, word, ink, key, correct to results.push({...}),
// to the CSV header, and to the .join(",") list