jsPsych / Behavioral experimentsRead · predict · build · inspect

Meeting 3 reference: Control flow and bounded practice

What you should be able to do

Flanker task that passes, repeats, or stops appropriately in both mapping groups. Explain the logic and verify at least one normal and one edge case, using the actual saved data.

Concepts in context

A block is a nested timeline with a distinct role. Practice and test may share a response-trial template but differ in feedback, item list, and eligibility. Explicit block labels prevent later analyses from relying on fragile row positions. Feedback rows have their own task label and must not count as practice responses.

The target direction and response key are separate concepts. The center character defines left/right; the assigned mapping defines F/J. The item list records direction and the trial computes the expected key. Show the active mapping. The teaching example uses B only when explicitly requested and A otherwise. The course default is A for local convenience; that is not a research allocation scheme.

Practice passes at 75% on the current four-item attempt and permits at most three attempts. The counter starts at 1 and increments in loop_function only when another attempt will run. A loop timeline’s on_timeline_start is not a per-repetition callback. Each practice row stores that attempt. The practice summary computes the criterion from those rows. The loop repeats only when the criterion is unmet and attempts remain. Test is separately guarded by conditional_function; otherwise a stopped loop could send a failed participant into test.

The failed-practice branch shows a helpful message and still allows export for diagnosis. It creates zero test rows. Missing responses are incorrect; feedback explicitly names no response instead of pretending a wrong key was pressed.

The item list uses the literal arrow characters ← and →, so the stimulus can be a simple HTML template string. These are fixed course stimuli, not text entered by a participant.

A practice exclusion is a design choice. Record and report its rule and stopped cases. Counterbalancing requires an assignment procedure and an audit of actual groups, not merely a URL parameter. The small supplied flanker list is a coding demonstration; stimulus repetition and limited trials constrain interpretation.

What to check in your implementation

Pass-first: 4 practice + 8 test. Fail-then-pass: 8 + 8. Fail-all: 12 + 0. In ←←→←← the correct direction is right; in →→←→→ it is left. Group A left=F/right=J; B reverses these. Practice attempt IDs must be 1,2,3 only where applicable.

Use the live exercises and workshop sheet as the practical sequence. Compare with the released reference solution after an attempt. The debugging guide provides a symptom-to-check table. Try one editable example and its practice check before the full task.

Questions to answer without copying the code

  1. Why is a loop cap not a test gate?
  2. Why filter the current attempt?
  3. What does alternating links accomplish?

Check your reasoning by running a small example; the instructor guide contains the expected explanations.

Reading (about 15 minutes)

Read the looping and conditional timeline sections. Bring the project proposal worksheet before Meeting 4.

Preparation for the next checkpoint

Explain the two failure protections and identify an attempt-2 row. See assessment and deadlines.

For Meeting 3, follow the local JATOS guide with the working Meeting 2 task. A .jzip transfers configuration and assets; export results separately. A localhost link works only on that computer. Cognition.run is the alternative.