Skip to content

Commit

Permalink
Improve task flow
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenuni committed Oct 17, 2023
1 parent 7801529 commit 162caa7
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 352 deletions.
3 changes: 1 addition & 2 deletions young/flanker_task.zp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import std_windows1;
import std_entry_page1;
import std_exit_page1;
import std_blank_page;
import std_pause_page;

import texts_en;

Expand All @@ -64,8 +65,6 @@ Experiment experiment

if (test::load_stimuli() != OK)
terminate;
if (test::shuffle_items() != OK)
terminate;
}

on_event:exit()
Expand Down
1 change: 1 addition & 0 deletions young/modules/globaldefs.zm
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ const real ARROW_HEIGHT = 50;
// Each block contains a single run of the entire stimulus list
const int NUMBER_OF_BLOCKS = 2;

const int NUM_ALLOWED_ERRORS = 2;
252 changes: 0 additions & 252 deletions young/modules/pause_page.zm

This file was deleted.

9 changes: 0 additions & 9 deletions young/stimuli/prac_items.csv

This file was deleted.

21 changes: 0 additions & 21 deletions young/stimuli/test_items.csv

This file was deleted.

39 changes: 39 additions & 0 deletions young/test/output.zm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,45 @@ record TestOutput
int correct;
}

TestOutput[] prac_output = {};

// Appends one row of data to test phase output table.
void prac_output_append(TestOutput data)
{
expdb.add_trial_data_record(namespace_name, "1", "TestResults");

expdb.set_trial_data_int_field("trialnum", data.trial_nr);
expdb.set_trial_data_int_field("id", data.id);
expdb.set_trial_data_enum_field("congruence", string(data.congruence));
expdb.set_trial_data_int_field("rt", data.rt);
expdb.set_trial_data_enum_field("selected_side", string(data.selected_side));
expdb.set_trial_data_enum_field("expected_side", string(data.expected_side));
expdb.set_trial_data_int_field("correct", data.correct);

prac_output.size = prac_output.size + 1;
prac_output[prac_output.size - 1] = data;
}

int calc_num_practice_correct()
{
int num_correct = 0;
int i = 0;

while (i < prac_output.size)
{
if (prac_output[i].correct)
num_correct += 1;
i++;
}

return num_correct;
}

void reset_practice_items()
{
prac_output.size = 0;
}

//------------------------------------------------------------------------------

// Appends one row of data to test phase output table.
Expand Down
29 changes: 7 additions & 22 deletions young/test/shuffle.zm
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,16 @@ HISTORY:

import stimuli;

const int SHUFFLE_MAX_ATTEMPTS = 100; // max number of shuffles before failing

// Shuffles test_items table (no restrictions on item order).
int shuffle_items()
int shuffle_test_items()
{
int nattempts = 0;
bool again = true;

while (again && nattempts < SHUFFLE_MAX_ATTEMPTS) {
test_items.shuffle(0, -1);
bool correct = check_rule_compliance();
again = !correct;
nattempts++;
}

if (again)
println("Unable to shuffle test_items according to criteria. "
"Check table and/or criteria.");

return again ? ERROR : OK;
test_items.shuffle(0,-1);
return OK;
}

// Checks whether the test items pseudo randomization is alright.
// Returns true, when everything is alright, false otherwise.
bool check_rule_compliance()
// Shuffles practice_items table (no restrictions on item order).
int shuffle_practice_items()
{
return true;
prac_items.shuffle(0,-1);
return OK;
}
Loading

0 comments on commit 162caa7

Please sign in to comment.