Last Modified: January 12, 2025 by K. Borchert (katjab@millisecond.com), Millisecond
Script Copyright © Millisecond Software, LLC
This script implements a computerized version of the Tower of Hanoi Task (TOH), a disk transfer task with 3 equally sized pegs, as described by Humes et al (1997). The TOH is considered a test of executive functioning with a focus on planning abilities.
Humes, G. E., Welsh, M. C., Retzlaff, P., & Cookson, N. (1997). Towers of Hanoi and London: Reliability and Validity of Two Executive Function Tasks. Assessment (Odessa, Fla.), 4(3), 249–257. https://doi.org/10.1177/107319119700400305
10 minutes
Participants are asked to arrange up to five disks of varying sizes on three different pegs in a specific goal pattern in as few moves as possible and observing two movement rules: "Only move the top disk" and "bigger disks may not be placed on top of smaller disks".
The default setup of the test session is based on Humes et al (1997).
However:
- you can add/edit an OPTIONAL practice session
- you can change the number of test problems run (see section Editable Lists)
- you can change the placements of the disks (see section Editable Lists),
Note that changing the disk placements will change the problems
(the maximum number of disks that can be used in this script is 5)
- you can change the goal state images under section Editable Stimuli
- you can change the scoring algorithm under expressions.scoring (see section Editable Parameters)
- you can change the number of attempts needed to move on to the next problem (see section Editable Parameters)
- you can change the number of allowed movements per attempt (see section Editable Parameters)
if you change the design of the test, you may have to update your
instructions (see section Editable Instructions) accordingly
• provided by Millisecond
•see section Editable Stimuli, different base/peg/disk images can be used (in that case positions of
base/pegs/disks may have to be adjusted)
•the start and goal states of each disk can be edited under section Editable Lists)
Instructions are provided by Millisecond.
They can be adjusted in script "towerofhanoi_instructions_inc.iqjs"
File Name: towerofhanoi_summary*.iqdat
| Name | Description |
|---|---|
| inquisit.version | Inquisit version number |
| computer.platform | Device platform: win | mac |ios | android |
| computer.touch | 0 = device has no touchscreen capabilities; 1 = device has touchscreen capabilities |
| computer.hasKeyboard | 0 = no external keyboard detected; 1 = external keyboard detected |
| startDate | Date the session was run |
| startTime | Time the session was run |
| subjectId | Participant ID |
| groupId | Group number |
| sessionId | Session number |
| elapsedTime | Session duration in ms |
| completed | 0 = Test was not completed 1 = Test was completed |
| runPractice | 1 = a practice session was run; 0 = otherwise |
| problemsStarted | Lists all test problemnumbers that were started in order |
| problemsSolved | Lists all test problemnumbers that were solved (in order) |
| totalScore | Score achieved across the whole set of test problems. In this script: Max is 72 |
| cumMoves | Cumulative number of moves made across all test problem sets attempted |
| cumMovesCS | Cumulative number of moves made across all test problem sets that were solved |
| cumOptimalMoves | Cumulative number of optimal moves across those test problem sets that were attempted |
| cumOptimalMovesCS | Cumulative number of optimal moves across those test problem sets that were solved |
| meanFirstMoveTime | Mean first move time (in ms); based on all recorded first move-times |
| meanSolutionTime | Mean solution time (in ms) - across all attempts |
| meanExecutionTime | Mean execution time (in ms) - across all attempts |
| meanPlanningTime | Mean planning time (in ms) - across all attempts |
| meanCorrSolutionTime | Mean solution time (in ms) - across successful attempts only |
| meanCorrExecutionTime | Mean execution time (in ms) - across successful attempts only |
| meanCorrPlanningTime | Mean planning time (in ms) - across successful attempts only |
| timePerMoveRatio | Mean amount of time (in ms) spent on each move (ratio of totalCompletionTime over the number of moves made) |
| moveAccRatio | Number of moves made in relationship to the number of optimal moves 1 = participant made only the number of optimal moves (but may NOT have solved the problems) |
| moveAccRatioCS | Number of moves made in relationship to the number of optimal moves (only calculated for solved problems) 1 = participant made only the optimal moves for the problems solved |
| countViolationsTotal | Counts the number of rule violations across problems |
File Name: towerofhanoi_raw*.iqdat
| Name | Description |
|---|---|
| build | Inquisit version number |
| computer.platform | Device platform: win | mac |ios | android |
| computer.touch | 0 = device has no touchscreen capabilities; 1 = device has touchscreen capabilities |
| computer.hasKeyboard | 0 = no external keyboard detected; 1 = external keyboard detected |
| date | Date the session was run |
| time | Time the session was run |
| subject | Participant ID |
| group | Group number |
| session | Session number |
| runPractice | 1 = a practice session was run; 0 = otherwise |
| blockcode | The name the current block (built-in Inquisit variable) |
| blocknum | The number of the current block (built-in Inquisit variable) |
| trialcode | The name of the currently recorded trial (built-in Inquisit variable) |
| trialnum | The number of the currently recorded trial (built-in Inquisit variable) trialnum is a built-in Inquisit variable; it counts all trials run even those that do not store data to the data file. |
| problemCount | Tracks the number of problems run |
| problemNumber | Current problem number (by default: 1-12) |
| goalstateCategory | "tower" vs. "flat" |
| nDisks | Stores the number of disks present in the current problem |
| targetMoves | Number of minimal moves to solve the current problem |
| targetAchieved | Returns 1 as soon as the subject has successfully reached a given problem's target / goal state. Otherwise 0. |
| subjectMoves | Number of subject-performed moves for the current problem. each rule violation counts as one extra move in this script |
| excessMoves | Returns the difference between number of moves performed by the subject ('subjectmoves') and the number of target moves for a given problem. |
| consecutiveCorrect | Counts the number of consecutive correct solutions for the same problem |
| stopTask | 1 = the task should be terminated at this point (values.success = 0 at end of all attempts for the current problem) 0 = otherwise |
| success | 1 = the current problem was solved correctly according to definition of success (default: success (test)= problem solved correctly twice in consecutive attempts) 0 = the current problem has not (yet) been successfully solved |
| achievementScore | Score awarded for solving the current test problem if values.success = 1. see expressions.scoring |
| totalScore | Score achieved across the whole set of test problems. In this script: Max is 72 |
| violation | 0 = no rule was violated with the currently recorded move 1 = rule 1 was violated ('no larger disk onto smaller disk') 2 = rule 2 was violated ('only top disk can be moved') (if rule 1 AND rule 2 are violated in the same move, only rule violation 2 is noted. The violations count as a single violation in this script) |
| countViolationsProblem | Counts the number of rule violations per problem |
| firstMoveTime | Returns the time (in ms) elapsed between initial presentation of the goal configuration and the initialization of the subject's first valid move. Sometimes also referred to as "planning time" or simply "latency". Measure is computed separately for each problem attempt. |
| solutionTime | Returns the time (in ms) elapsed between initial presentation of the goal configuration and a subject's successful solution or problem termination. Measure is computed separately for each problem attempt. |
| executionTime | Computed as solutiontime - firstmovetime. Measure is computed separately for each problem attempt. |
| planningTime | Computed as solutionTime - executionTime. Measure is computed separately for each problem. |
| tChoiceStart | Absolute start time for trial.choice in ms. May be used to derive additional measures during data analysis (e.g. mean move time). |
| tChoiceend | Absolute end time for trial.choice in ms. May be used to derive additional measures during data analysis (e.g. mean move time). |
| totalCompletionTime | Cumulative solution times across all problem sets attempted |
| latency | The latency of the current response in ms (or if no response: trialduration) |
| response | Response made (the peg that was moved to) |
| trial.choice.lastDropSource | The last moved disk (d1, d2, d3, d4, or d5) |
| trial.choice.lastDropTarget | The last peg that a disk was moved to (apeg, bpeg, cpeg) |
| moveString | Text string containing a record of performed moves. E.g. "1apeg," indicates that disk1 (the smallest) was moved to pegA (the left one). A rule violation is expressed as "rule1violation (2bpeg)" => disk2 was moved onto a smaller disk onto b-peg |
| topInA | Returns the disk number (1, 2, 3, 4, or 5) currently inhabiting the top position on peg 1 (left). Returns 'none' if peg is empty. Used to determine valid responses in 'trial.choice'. |
| topInB | Returns the disk number (1, 2, 3, 4, or 5) currently inhabiting the top position on peg 2 (center). Returns 'none' if peg is empty. Used to determine valid responses in 'trial.choice'. |
| topInC | Returns the disk number (1, 2, 3, 4, or 5) currently inhabiting the top position on peg 3 (right). Returns 'none' if peg is empty. Used to determine valid responses in 'trial.choice'. |
| aCount | The number of disks currently placed on peg 1 (left). |
| bCount | The number of disks currently placed on peg 2 (center). |
| cCount | The number of disks currently placed on peg 3 (right). |
| cumMoves | Cumulative number of moves made across all test problem sets attempted |
| cumMovesCS | Cumulative number of moves made across all test problem sets that were solved |
| cumOptimalMoves | Cumulative number of optimal moves across those test problem sets that were attempted |
| cumOptimalMovesCS | Cumulative number of optimal moves across those test problem sets that were solved |
The procedure can be adjusted by setting the following parameters.
| Name | Description | Default |
|---|---|---|
Design |
||
| runPractice | True = a practice session is run Note by default only one practice problem is provided. If additional or different practice problems should be run create the additional practice goal state images and add them under section Editable Stimuli and set the practice problems under section Editable Lists false = no practice session is run | true |
| maxMovementsPerProblemPractice | Number of allowed movements during a practice problem if more movements are made during a practice problem, the current practice problem is terminated and the next (if any) is started. in this script all participants move on to the test session if they failed the practice problem(s). | 20 |
| maxAttemptsPerProblem | Number of attempts per test problem (see Humes et al, 1997, p.251) | 6 |
| maxMovementsPerAttempt | Number of allowed movements per attempt (see Humes et al, 1997, p.251) | 20 |
| maxConsecutiveCorrectPerProblem | Number of consecutive correct solution per problem that are needed to advance to the next problem (see scoring rules in Humes et al, 1997, p.251) | 2 |
| showMovementInfo | True = presents the optimal number of movements and tracks the participant's movement on screen (default) false = no movement info is presented to participant | true |
| showScores | True = score information is presented to participant false = no score information is presented to participant (default) | false |
| showRuleReminder | True = rules are displayed on screen throughout the task (default) false = rules are not displayed on screen | true |
| nASlots | Capacity of peg 1 (left). Max supported is 5. | 5 |
| nBSlots | Capacity of peg 2 (middle). Max supported is 5. | 5 |
| nCSlots | Capacity of peg 3 (right). Max supported is 5. | 5 |
Color Parameter |
||
| canvasColor | Display color of the actively used portion of the screen (the 'canvas') if set to a color other than the screenColor, the active canvas appears 'anchored' on the screen regardless of monitor size | black |
| screenColor | Color of the screen not used by the canvas ('inactive screen') | black |
| defaultTextColor | Default color of text items presented on active canvas | white |
Disk Coordinates In Canvas%: H = Horizontal (3 Peg Positions); V = Vertical (5 Positions Per Peg) |
||
| h1 | Position of peg1 (left) | 20% |
| h2 | Position of peg2 (middle) | 50% |
| h3 | Position of peg3 (right) | 80% |
| v1 | Bottom position of a disk on a peg | 84.5% |
| v2 | Bottom/middle position of a disk on a peg | 76.15% |
| v3 | Middle position of a disk on a peg | 67.85% |
| v4 | Middle/top position of a disk on a peg | 59.50% |
| v5 | Top position of a disk on a peg | 51.25% |
Timing Parameters |
||
| feedbackDurationMS | The feedback duration in ms | 3000 |