fixed die
This commit is contained in:
170
index.js
170
index.js
@@ -45,46 +45,42 @@ debug =
|
||||
jsPsych.data.getURLVariable('debug') === 'true' ||
|
||||
import.meta.env.VITE_DEBUG === 'true';
|
||||
|
||||
console.log('debug:', debug);
|
||||
|
||||
prolific_id = jsPsych.data.getURLVariable('PROLIFIC_PID');
|
||||
|
||||
const COND = Number(jsPsych.data.getURLVariable('C'));
|
||||
|
||||
const probe_preamble = `In this experiment, we told you that you would roll a die to determine the difficulty of the captcha task.\nHowever, `;
|
||||
const probe_closing_text = `\n\nPlease share your thoughts and suspicions about this by indicating your agreement with the following statements.`;
|
||||
const probe_closing_text = `<p class ="mt-6">On the next page, you will be asked about your suspicions and thoughts about this aspect of the study.</p>
|
||||
<p class="mt-6">Press <span class = "font-semibold"> SPACE</span> to continue</p>`;
|
||||
|
||||
const probe_text_die =
|
||||
probe_preamble +
|
||||
'the die roll was rigged, so that the number you received (and therefore the difficulty of the captcha task) was pre-determined. ' +
|
||||
`<p> In this study, the die roll to determine captcha difficulty was rigged: the number you rolled was predetermined.</p><p class="mt-2"> Therefore, the difficulty of the captcha task was also predetermined.</p>` +
|
||||
probe_closing_text;
|
||||
const probe_text_difficulty =
|
||||
probe_preamble +
|
||||
'while the die roll was random, the difficulty of the captcha task was pre-determined and unrelated to the die roll. ' +
|
||||
`In this study, the die roll to determine captcha difficulty was indeed random. </p><p class="mt-2"> However, the difficulty of the captcha task was pre-determined. It was unrelated to the die roll.
|
||||
</p>` +
|
||||
probe_closing_text;
|
||||
|
||||
let die_result = 3;
|
||||
const probe_text_baseline = probe_closing_text
|
||||
|
||||
const die_result = Math.random() < 0.5 ? 3 : 4;
|
||||
|
||||
switch (COND) {
|
||||
case 0:
|
||||
probe_condition = 'die';
|
||||
probe_order = 'die_first';
|
||||
die_result = 4;
|
||||
break;
|
||||
case 1:
|
||||
probe_condition = 'die';
|
||||
probe_order = 'die_first';
|
||||
die_result = 4;
|
||||
break;
|
||||
case 2:
|
||||
probe_condition = 'difficulty';
|
||||
probe_order = 'die_first';
|
||||
die_result = 4;
|
||||
break;
|
||||
case 3:
|
||||
probe_condition = 'difficulty';
|
||||
probe_order = 'die_first';
|
||||
die_result = 4;
|
||||
break;
|
||||
case 4:
|
||||
probe_condition = 'die';
|
||||
@@ -102,6 +98,22 @@ switch (COND) {
|
||||
probe_condition = 'difficulty';
|
||||
probe_order = 'difficulty_first';
|
||||
break;
|
||||
case 8:
|
||||
probe_condition = 'baseline';
|
||||
probe_order = 'die_first';
|
||||
break;
|
||||
case 9:
|
||||
probe_condition = 'baseline';
|
||||
probe_order = 'die_first';
|
||||
break;
|
||||
case 10:
|
||||
probe_condition = 'baseline';
|
||||
probe_order = 'difficulty_first';
|
||||
break;
|
||||
case 11:
|
||||
probe_condition = 'baseline';
|
||||
probe_order = 'difficulty_first';
|
||||
break;
|
||||
}
|
||||
|
||||
const stimulusMap = getStimulusMap();
|
||||
@@ -174,6 +186,21 @@ const pre_survey_info = {
|
||||
stimulus: stimulusMap.get('pre_survey_info'),
|
||||
};
|
||||
|
||||
const die_roll_practice_trial = {
|
||||
type: JsPsychDieRoll,
|
||||
prompt: html`
|
||||
<p class="mt-2">Before the real die roll, you can practice here.</p>
|
||||
<p class="mt-2">
|
||||
Click the die once to start it rolling, then click it again to stop.
|
||||
</p>
|
||||
`,
|
||||
practice_trial: true,
|
||||
practice_roll_limit: 3,
|
||||
roll_duration: 2200,
|
||||
result_template:
|
||||
'Practice roll {{roll_number}}/{{roll_limit}}: You rolled a {{value}}.',
|
||||
};
|
||||
|
||||
const die_roll_trial = {
|
||||
type: JsPsychDieRoll,
|
||||
prompt: html`
|
||||
@@ -204,6 +231,13 @@ const create_captcha_trial = trial_index => {
|
||||
};
|
||||
};
|
||||
|
||||
const pre_die_roll_info = {
|
||||
type: jsPsychHtmlKeyboardResponse,
|
||||
choices: [' '],
|
||||
stimulus: `<p>Practice complete. Now you will roll a die to determine the difficulty of the captcha task.</p>
|
||||
<p class="mt-2">Press <span class ="font-bold">SPACE</span> to continue</p>`,
|
||||
};
|
||||
|
||||
const captcha_trials = Array.from({ length: CAPTCHA_TRIAL_COUNT }, (_, index) =>
|
||||
create_captcha_trial(index)
|
||||
);
|
||||
@@ -245,12 +279,12 @@ const survey_function = survey => {
|
||||
});
|
||||
};
|
||||
|
||||
const survey = {
|
||||
const survey_1 = {
|
||||
type: jsPsychSurvey,
|
||||
survey_function: survey_function,
|
||||
survey_json: {
|
||||
showQuestionNumbers: false,
|
||||
completeText: 'Done!',
|
||||
completeText: 'Continue',
|
||||
pageNextText: 'Continue',
|
||||
pagePrevText: 'Previous',
|
||||
showPrevButton: false,
|
||||
@@ -266,10 +300,6 @@ const survey = {
|
||||
isAllRowRequired: debug ? false : true,
|
||||
rowOrder: 'random',
|
||||
rows: [
|
||||
{
|
||||
text: `I found the captcha task difficult.`,
|
||||
value: 'Difficulty',
|
||||
},
|
||||
{
|
||||
text: `I felt lucky during the die roll.`,
|
||||
value: 'Luck',
|
||||
@@ -278,6 +308,47 @@ const survey = {
|
||||
text: `I felt unlucky during the die roll.`,
|
||||
value: 'Bad_luck',
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
value: 5,
|
||||
text: 'Strongly agree',
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
text: 'Agree',
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
text: 'Neutral',
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
text: 'Disagree',
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
text: 'Strongly disagree',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'page2',
|
||||
elements: [
|
||||
{
|
||||
type: 'matrix',
|
||||
name:
|
||||
'Please answer the following questions about your experience in the captcha task.',
|
||||
alternateRows: true,
|
||||
isAllRowRequired: debug ? false : true,
|
||||
rowOrder: 'random',
|
||||
rows: [
|
||||
{
|
||||
text: `I found the captcha task difficult.`,
|
||||
value: 'Difficulty',
|
||||
},
|
||||
{
|
||||
text: `I think I solved all the captchas correctly.`,
|
||||
value: 'Accuracy',
|
||||
@@ -316,15 +387,43 @@ const survey = {
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const pre_manip_info = {
|
||||
type: jsPsychHtmlKeyboardResponse,
|
||||
choices: [' '],
|
||||
stimulus: function () {
|
||||
switch (probe_condition) {
|
||||
case 'die':
|
||||
return probe_text_die;
|
||||
case 'difficulty':
|
||||
return probe_text_difficulty;
|
||||
case 'baseline':
|
||||
return probe_text_baseline;
|
||||
default:
|
||||
return 'ERROR: probe condition not recognized';
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const survey_2 = {
|
||||
type: jsPsychSurvey,
|
||||
survey_function: survey_function,
|
||||
survey_json: {
|
||||
showQuestionNumbers: false,
|
||||
completeText: 'Done!',
|
||||
pageNextText: 'Continue',
|
||||
pagePrevText: 'Previous',
|
||||
showPrevButton: false,
|
||||
pages: [
|
||||
{
|
||||
name: 'page2',
|
||||
name: 'page1',
|
||||
elements: [
|
||||
{
|
||||
type: 'matrix',
|
||||
name:
|
||||
probe_condition === 'die'
|
||||
? probe_text_die
|
||||
: probe_text_difficulty,
|
||||
name: "Please indicate your agreement with the following statements.",
|
||||
alternateRows: true,
|
||||
isAllRowRequired: debug ? false : true,
|
||||
rowOrder: 'random',
|
||||
@@ -364,6 +463,21 @@ const survey = {
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'page2',
|
||||
elements: [
|
||||
{
|
||||
type: 'comment',
|
||||
title: `Please write a sentence or two on what you thought the study was about.`,
|
||||
isRequired: debug == true ? false : true,
|
||||
},
|
||||
{
|
||||
type: 'comment',
|
||||
title: ` Indicate any other thoughts or suspicions you had about the study. \n`,
|
||||
isRequired: debug == true ? false : true,
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'page3',
|
||||
@@ -403,22 +517,28 @@ const survey = {
|
||||
const main_experiment_timeline = [
|
||||
instructions_1,
|
||||
instructions_2,
|
||||
die_roll_practice_trial,
|
||||
pre_die_roll_info,
|
||||
die_roll_trial,
|
||||
instructions_3,
|
||||
...captcha_trials,
|
||||
pre_survey_info,
|
||||
survey,
|
||||
survey_1,
|
||||
pre_manip_info,
|
||||
survey_2,
|
||||
debrief,
|
||||
];
|
||||
|
||||
|
||||
if (debug) {
|
||||
timeline.push(die_roll_trial);
|
||||
timeline.push(...main_experiment_timeline);
|
||||
}
|
||||
|
||||
if (!debug) {
|
||||
timeline.push(pre_consent_info);
|
||||
timeline.push(consent_form);
|
||||
timeline.push(enter_fullscreen);
|
||||
timeline.push(consent_form);
|
||||
timeline.push(...main_experiment_timeline);
|
||||
}
|
||||
jsPsych.run(timeline);
|
||||
|
||||
Reference in New Issue
Block a user