Return to the Hearts and Flowers Task (Mouse/Touch Input) page
___________________________________________________________________________________________________________________	

							*Hearts and Flowers Task - a child friendly Simon's Task* 
							(touchscreen/mouse input version)
___________________________________________________________________________________________________________________	

Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
Date: 03-26-2018
last updated:  10-28-2019 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright © 10-28-2019 Millisecond Software

___________________________________________________________________________________________________________________
BACKGROUND INFO 	
___________________________________________________________________________________________________________________	
This script implements the Hearts and Flowers Task (a child friendly Simon's Task), a test of Executive Control. 
The task is described in:

Diamond, A., Barnett, W.S., Thomas,J. & Munro, S. (2007). Preschool Program Improves
Cognitive Control. SCIENCE, 318, 1387-1388 
(as well as supporting documents)

The Hearts and Flowers Task is based on the Dot-Task:

M.C. Davidson, D. Amso, L.C. Anderson, A. Diamond (2006). Development of cognitive control and executive functions 
from 4 to 13 years: Evidence from manipulations of memory, inhibition, and task switching. 
Neuropsychologia 44, 2037–2078

This script is designed for touchscreen/mouse input
(check out heartsandflowerstask_keyboard.iqx for the same task designed for keyboard input)


___________________________________________________________________________________________________________________
TASK DESCRIPTION
___________________________________________________________________________________________________________________	
Participants are presented trials with either a heart or a flower that appear to the left or right of 
a fixation cross. If participants see a heart, they are asked to press the corresponding left or right 
response button (=congruent trials).
For example, if the heart is left to the fixation cross, participants are asked to press the left button.
If participants see a flower, they are asked to press the opposite response button (=incongruent trials).
For example, if the flower is left to the fixation cross, participants are asked to press the right button key.

3 main blocks to test the three core abilities of Executive Control (Diamond et al, 2007)*:
1) only congruent trials: participants work through a block of heart trials (Working Memory)
2) only incongruent trials: participants work through a block of flower trials (Working Memory + Inhibitory Control)
3) mixed trials: participants work through a random mix of heart and flower trials 
(Working Memory + Inhibitory Control + Cognitive Flexibility)

*Note:
The following are the three core abilities of Executive Control (Diamond et al, 2007)
1. Working Memory: Remember the rules and execute them accordingly
2. Inhibitory Control: Ability to override behavioral impulses
3. Cognitive Flexibility: Adapt behavior to changing demands

___________________________________________________________________________________________________________________	
DURATION 
___________________________________________________________________________________________________________________	
the default set-up of the script takes appr. 7 minutes to complete

___________________________________________________________________________________________________________________	
DATA FILE INFORMATION 
___________________________________________________________________________________________________________________
The default data stored in the data files are:

(1) Raw data file: 'heartsandflowerstask_mi_raw*.iqdat' (a separate file for each participant)*

build:							The specific Inquisit version used (the 'build') that was run
computer.platform:				the platform the script was run on (win/mac/ios/android)
date, time, 						date and time script was run 
subject, group, 					with the current subject/groupnumber
script.sessionid:					with the current session id

blockcode, blocknum:				the name and number of the current block (built-in Inquisit variable)
trialcode, trialnum: 				the name and number of the currently recorded trial (built-in Inquisit variable)
										Note: trialnum is a built-in Inquisit variable; it counts all trials run; even those
										that do not store data to the data file such as feedback trials. Thus, trialnum 
										may not reflect the number of main trials run per block. 
										
values.condition:						1 = congruent-only; 
									2 = incongruent-only; 
									3 = mixed
									
values.position:						1 = stimulus is positioned on the left; 
									2 = stimulus is positioned on the right
									
values.congruence:					1 = congruent trial; 
									2 = incongruent trial
									
values.prevCongruence:				the congruence of the previous trial (important for mixed condition only)

values.switch:						1 = switch trial (trial type changed from congruent to incongruent or vice versa);
									2 = nonswitch trial (trial type stayed the same)
									
values.countSwitch:					counts the number of switch trials per block									
									
stimulusitem.1:						the presented stimuli in order of trial presentation

response:							the participant's response
										leftresponsebutton
										rightresponsebutton
										
correct:								accuracy of response: 
										1 = correct response; 
										0 = otherwise
										
latency: 								the response latency (in ms); measured from: onset of stim

list.ACC_practice.mean:				the proportion correct during the current practice block
values.countCongruent:				counts the number of congruent practice blocks run
values.countIncongruent:				counts the number of incongruent practice blocks run
values.countMixed:					counts the number of mixed practice blocks run


(2) Summary data file: 'heartsandflowerstask_mi_summary*.iqdat' (a separate file for each participant)*

computer.platform:				the platform the script was run on (win/mac/ios/android)
script.startdate:					date script was run
script.starttime:					time script was started
script.subjectid:					assigned subject id number
script.groupid:					assigned group id number
script.sessionid:					assigned session id number
script.elapsedtime:				time it took to run script (in ms); measured from onset to offset of script
script.completed:					0 = script was not completed (prematurely aborted); 
								1 = script was completed (all conditions run)

Practice Performance:

values.countCongruent:				counts the number of congruent practice blocks run
values.practiceACC_congruent:			the highest proportion correct in one of the congruent practice blocks (if not run, propCorrect = 0)
values.passCongruent:					1 = participant successfully passed the congruent practice; 
									0 = otherwise
									
values.countIncongruent:				counts the number of incongruent practice blocks run
values.practiceACC_incongruent:		the highest proportion correct in one of the incongruent practice blocks (if not run, propCorrect = 0)
values.passInCongruent:				1 = participant successfully passed the incongruent practice; 
									0 = otherwise
									
values.countMixed:					counts the number of mixed practice blocks run
values.practiceACC_mixed:				the highest proportion correct in one of the mixed practice blocks (if not run, propCorrect = 0)
values.passMixed:						1 = participant successfully passed the mixed practice; 
									0 = otherwise
									
Test Performance:									

expressions.propCorrect:				proportion correct across all test trials
expressions.meanRT:					mean latency of correct responses across all test trials

expressions.propCorrect_congruent:				proportion correct across congruent-only test trials
expressions.meanRT_congruent:				mean latency of correct responses across congruent-only test trials

expressions.propCorrect_incongruent:			proportion correct across incongruent-only test trials
expressions.meanRT_incongruent:				mean latency of correct responses across incongruent-only test trials

expressions.propCorrect_mixed:				proportion correct across test trials in mixed block
expressions.meanRT_mixed:					mean latency of correct responses across test trials in mixed block

expressions.propCorrect_mixed_switch:			proportion correct across switch trials in mixed block
expressions.meanRT_mixed_switch:				mean latency of correct responses across switch test trials in mixed block
											switch trial: switch from congruent to incongruent trial and vice versa

expressions.propCorrect_mixed_nonswitch:		proportion correct across nonswitch trials in mixed block
expressions.meanRT_mixed_nonswitch:			mean latency of correct responses across nonswitch test trials in mixed block

expressions.propCorrect_mixed_congruent:		proportion correct across congruent test trials in mixed block
expressions.meanRT_mixed_congruent:			mean latency of correct responses across congruent test trials in mixed block

expressions.propCorrect_mixed_incongruent:		proportion correct across incongruent test trials in mixed block
expressions.meanRT_mixed_incongruent:		mean latency of correct responses across incongruent test trials in mixed block

expressions.SimonEffect	:			ms difference in "[mean corrRT mixed Incongruent] - [mean corrRT mixed Congruent]"
									positive value: participants responded faster when 
									stimulus location and response button location were congruent 
									("stimulus-response compatibility") => Simon Effect
									[negative value: participants responded faster when 
									stimulus location and response button location 
									were incongruent]

___________________________________________________________________________________________________________________	
EXPERIMENTAL SET-UP 
___________________________________________________________________________________________________________________

3 main conditions: run in sequence
1. Congruent-Only: 20 'heart' trials (10 hearts appear left, 10 hearts appear right): 
press matching response button

2. Incongruent-Only: 20 'flower' trials (10 flowers appear left, 10 flowers appear right): 
press opposite response button

3. Mixed*: 10 'heart' trials (5 hearts left, 5 hearts right), 10 'flowers' trials 
(5 flowers left, 5 flowers right)
	=> random order with constraint that max. 3 of the same trials can be run consecutively
	=> number of switch trials will vary (minimum number of switch trials = 6 for 20 trials)									
		switch trial: switch from congruent to incongruent trial and vice versa	
* Diamond et al (2007) do not specify how the mixed condition is set up in detail other than that
the trials were randomly intermixed. In this script, a constraint was placed on the random selection to 
ensure that a minimum of switch trials would run for each participant.
	

Each condition runs:
A. Practice Block(s): a maximum of 3 (default, can be set under section Editable Parameters) practice blocks of 
8 trials. If participants reach a performance of 75% correct (default, can be set under 
section Editable Parameters) during any of the blocks, the test block is started - otherwise the script is aborted
after 3 unsuccessful practice blocks.
During practice, participants receive positive feedback for 500ms in the form of a 'smiley' and auditory feedback
if they press the correct response button. For incorrect responses as well as noresponses, participants will 
get a visual and auditory reminder of the rules and have to retry the trial (at this point, only correct responses
are accepted to move to the next trial).

B. Test Block: 
Each Test Block runs 20 trials.

Note: number of trials per block can be set under section Editable Parameters

Trial Sequence:
stimulus (heart or flower)-> max. 5000ms(congruent-only and incongruent-only)/6000ms (mixed) -> iti: 1000ms
(timings can easily be changed under section Editable Parameters)

___________________________________________________________________________________________________________________	
STIMULI
___________________________________________________________________________________________________________________	
provided by Millisecond Software - can be edited under section Editable Stimuli

___________________________________________________________________________________________________________________	
INSTRUCTIONS 
___________________________________________________________________________________________________________________
provided by Millisecond Software (not original to Diamond et al, 2007)- can be edited under 
section Editable Instructions

__________________________________________________________________________________________________________________	
EDITABLE CODE 
___________________________________________________________________________________________________________________	
check below for (relatively) easily editable parameters, stimuli, instructions etc. 
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code 
to further customize your experiment.

The parameters you can change are:

/congruentStim:					stores the label used for the congruent stim (default: "heart")
/incongruentStim:					stores the label used for the incongruent stim (default: "flower")
										Note: if the stimuli are changed, picture.congruentStim and picture.incongruentStim need
										to be updated accordingly

/minPracticeACC:					the minimum practice performance (proportion correct) to let participants move from a 
								practice block to a test block (default: 0.75)
								
/maxPracticeRepeats:				number of times a practice blocks can be repeated before the script is aborted (default: 3)
/numberPracticeTrials:				the number of practice trials per practice block (default: 8)

/numberTestTrials:				the number of test trials per test block (default: 20)
									Note: the number of trials should be divisible by 4

/stimDuration_simpleBlock:			the duration (in ms) of the stimulus presentation (= response timeout) for a 'simple' (= one stimulus) block (default: 5000)
/stimDuration_mixedBlock:			the duration (in ms) of the stimulus presentation (= response timeout) for the mixed block (default: 6000)
/iti:								the intertrial interval (in ms) (default: 1000)

/picSize:							the proportional sizing (proportional to canvas height) of the pictures (default: 10%)
/fixationSize:						the proportional sizing (proportional to canvas height) of the fixation cross (default: 15%)
/left_x:							the left x-coordinate in canvas percentage (default: 30%)
/right_x:							the right x-coordinate in canvas percentage (default: 70%)
									Note: left edge of canvas = 0%, right edge of canvas = 100%
									(canvas = portion of the screen dedicated for the script)