APCSPStroopExample
The APCSPStroopExample
app is described in the Screen1.AboutScreen
.
This app demonstrates ‘…the delay in reaction time between congruent and incongruent stimuli’ known as the Stroop Effect — try to say the color of the word, not the word itself.
The app illustrates all aspects of the APCS-P requirements for the Create Performance Task:
• List storing and access used to manage the complexity of the program;
• A procedure w/ a parameter that is called from different places with different values and whose behavior varies based on the value of the parameter; and
• An algorithm that includes sequencing, selection, and repetition.
Button
invokes the reset procedure, which invokes the stroop procedure to shuffle the color names and their colors.Button1
, Button2
, Button3
, Button4
, Button5
, Button6
, and Button7
do nothing, but provide the canvas for the names and their colors.Button
invokes the stroop procedure with a flag specifying that the word colors match the word names.Button
invokes the stroop procedure with a flag specifying that the word colors do not match the word names.The submission for the APCS-P Create Performance Task includes a written response to questions 3a (i-iii), 3b (i-v), 3c (i-iv), and 3d (i-iii) to meet the requirements of the scoring guidelines.
Button
s — Matching or Shuffle. The output of the program is presenting subjects with a shuffled list of color names with matching colors (when the Matching Button
is clicked) or a shuffled list of color names with shuffled colors (when the Shuffled Button
is clicked).nameIndexes
list is a local variable both stored and used in the program code for the stroop
procedure (above) to partially fulfill the programs purpose.stroop
procedure (above), the nameIndexes
list is stored as a local variable by the shuffle
procedure, shuffling a range of integers.In the program code for the stroop
procedure (above), the nameIndexes
list is used, in turn, by the stroop
procedure to initialize another local variable (colorIndexes
), shuffling a copy of the nameIndexes
list if the shuffle?
parameter is true
.
For example (if the shuffle?
parameter is true
), because shuffling is random, the stroop
procedure might generate the following 7-element lists:
List | Index 1 |
Index 2 |
Index 3 |
Index 4 |
Index 5 |
Index 6 |
Index 7 |
---|---|---|---|---|---|---|---|
rangeList |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
nameIndexes |
7 |
1 |
6 |
3 |
4 |
5 |
2 |
colorIndexes |
6 |
7 |
2 |
4 |
5 |
3 |
1 |
nameIndexes
list represents the shuffled names of colors and the colorIndexes
list (which is the shuffled nameIndexes
list when the shuffle?
parameter is true
) represents the colors of the names. In the example, the Button
at index 1
will have the color name at index 7
and the color at index 6
, the Button
at index 2
will have the color name at index 1
and the color at index 7
, etc. This assumes that the global names
list and the global colors
list (shown in the program code above) are parallel lists with corresponding elements.shuffle
procedure (above), the heart of Satollo’s Algorithm is in swapping the elements of the list(s). Using list(s) to contain the shuffled elements manages the complexity of the program code, because the alternative to the program code for the swap
procedure (above) which swaps the elements of the list(s), is to use a fixed number of (global) variables to achieve the same result. For example, even with only three elements (global variables element1
, element2
, element3
), the code for an example swapVariables
procedure could be:names
and the global colors
parallel lists with new corresponding elements would not require any program code changes.stroop
procedure (above) is a student-developed procedure with at least one parameter that has an effect on the functionality of the procedure. The parameter shuffle?
is a Boolean value that determines whether the colorIndexes
local-variable list is a shuffled copy of the nameIndexes
local-variable list or whether the colorIndexes
local-variable list is a reference to the nameIndexes
parameter and not shuffled relative to it.ButtonMatching.Click
event (above) shows where the student-developed procedure (stroop
) is called with a false
value for the shuffle?
parameter — which is tested prior to shuffling the colorIndexes
local-variable list resulting in the shuffled color names matching the colors. The ButtonShuffled.Click
event (above) shows where the student-developed procedure (stroop
) is called with a true
value for the shuffle?
parameter — which is tested prior to shuffling the colorIndexes
local-variable list resulting in the shuffled color names not matching the colors.stroop
procedure (above) is a student-developed algorithm that includes sequencing (more than one program block), selection (an if / else
block that either shuffles or does not shuffle the nameIndexes
local-variable list), and iteration (a for each
counted loop that sets the properties of Button
s in the buttons
global-variable list).buttons
(containing references to the buttons whose text and text colors are to be modified), names
(containing color names), and colors
(containing colors corresponding to the color names).names
and colors
lists. Shuffle the nameIndexes
list (the indexes of the names
list) relative to the indexes in order. Either shuffle the colorIndexes
list (the indexes of the colors
list) relative to the nameIndexes
list (in the shuffled Stroop Test) or do not shuffle the colorIndexes
list (the indexes of the colors
list) relative to the nameIndexes
list (in the matching Stroop Test).buttons
list, setting the text for each button to the name referred to in the names
list indexed indirectly by the index in the corresponding position in the nameIndexes
list and setting the color for each button to the color referred to in the colors
list indexed indirectly by the index in the corresponding position in the colorIndexes
list.shuffle
procedure is a version of Satollo’s Algorithm that shuffles lists in place.ButtonMatching.Click
event (above) shows where the student-developed procedure (stroop
) is called with a false
value for the shuffle?
parameter — which is tested prior to shuffling the colorIndexes
local-variable list resulting in the shuffled color names matching the colors.ButtonShuffled.Click
event (above) shows where the student-developed procedure (stroop
) is called with a true
value for the shuffle?
parameter — which is tested prior to shuffling the colorIndexes
local-variable list resulting in the shuffled color names not matching the colors.The submission for the APCS-P Create Performance Task includes a video that, ‘…demonstrates the running of [the] program.’
All components retain their default properties, — except Width
and Height
set to Fill parent...
where necessary to center UX components, Button
text(s) changed from their defaults(s), and Screen1.AboutScreen
set to the explanatory text (above).
🔗 permalink, 🔩 repository, and .AIA
for this page.