-
Notifications
You must be signed in to change notification settings - Fork 0
/
stimuli.js
77 lines (66 loc) · 1.87 KB
/
stimuli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
////////////////
// STIMULI
///////////////
// Item types
const PRACTICE = "PRACTICE";
const TARGET = "TARGET";
// name for lists, in this case one list, one item in the list
const LISTS = ["default"];
// In case of more complex design, the above could be, for example:
// const LISTS = [
// "my_first_list",
// "my_second_list"
// ];
const PRACTICE_ITEMS = [
{
id: 1, item_type: PRACTICE, image: './img/ChurchTableNecklaceRing.jpg',
sound: './sounds/BlinktEenKettingGras.wav',
},
];
const LIST_1 = [
{
id: 2, item_type: TARGET, image: './img/TaartPlantPlasDiamant.jpg',
sound: './sounds/LigtEenPlasVeld.wav',
},
{
id: 3, item_type: TARGET, image: './img/BookCraddlePlantWheel.jpg',
sound: './sounds/LigtEenWielKamer.wav',
},
];
const TEST_ITEMS = [
{list_name: LISTS[0], table: LIST_1}
];
// If there were two lists to choose from:
// const TEST_ITEMS = [
// {list_name: LISTS[0], table: LIST_1},
// {list_name: LISTS[1], table: LIST_2}
// ];
/**
* Get the list of practice items
*
* Returns an object with a list and a table, the list will always indicate
* "practice" since it are the practice items
*
* @returns {object} object with list and table fields
*/
function getPracticeItems() {
return {list_name : "practice", table : PRACTICE_ITEMS};
}
/**
* This function will pick a random list from the TEST_ITEMS array.
* @returns {object} object with one or more "lists" and table fields
*/
function pickRandomList() {
let range = function (n) {
let empty_array = [];
let i;
for (i = 0; i < n; i++) {
empty_array.push(i);
}
return empty_array;
}
let num_lists = TEST_ITEMS.length;
var shuffled_range = jsPsych.randomization.repeat(range(num_lists), 1);
var retlist = TEST_ITEMS[shuffled_range[0]];
return retlist;
}