Commit 85ef9831 authored by Ciranka's avatar Ciranka

added experiment and Mind in Eyes Code

parent 5ada5e72
......@@ -2,3 +2,4 @@
*.Rhistory
*.RData
*.Ruserdata
.Rproj.user
load("/Users/ciranka/Documents/Experiments Java Script/HelloWorld/socialInfo.RData")
socialInfo
dataExp
load("/Users/ciranka/Documents/Experiments Java Script/OCU/socialInfo.RData")
This diff is collapsed.
This diff is collapsed.
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Erstellungszeit: 12. Feb 2018 um 16:59
-- Server-Version: 10.1.30-MariaDB
-- PHP-Version: 7.1.13
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Datenbank: `MarbleOCU`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `MarbleOCU`
--
CREATE TABLE `MarbleOCU` (
`rt` text,
`stimulus1` text,
`stimulus2` text,
`key_press` text,
`old_order` text,
`riskyKey` text,
`new_order` text,
`changed_Order` text,
`red_marbles` text,
`blue_marbles` text,
`OtherChoseRisk` text,
`ChooseRisk` text,
`valueGamble` text,
`probGamble` text,
`Social1Ind0` text,
`payoff` text,
`cumulatedPayoff` text,
`valueSure` text,
`trialID` text,
`PercentBlueEstimate` text,
`HowSure` text,
`test_part` text,
`sex` text,
`age` text,
`subject` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
text ='[{"data":{"condition":1,"sequence_marbles_color1":[1,1,2,0,1],"sequence_marbles_color2":[0,0,2,2,0],"id":"img/05.png"}},\
{"data":{"condition":1,"sequence_marbles_color1":[0,0,1,0,1],"sequence_marbles_color2":[1,1,3,1,1],"id":"img/025.png"}},\
{"data":{"condition":1,"sequence_marbles_color1":[1,3,1,1,1],"sequence_marbles_color2":[0,1,1,0,0],"id":"img/075.png"}},\
{"data":{"condition":1,"sequence_marbles_color1":[1,1,1,3,0],"sequence_marbles_color2":[0,0,1,1,1],"id":"img/0675.png"}},\
{"data":{"condition":1,"sequence_marbles_color1":[0,0,0,0,1],"sequence_marbles_color2":[1,4,1,2,0],"id":"img/0125.png"}},\
{"data":{"condition":1,"sequence_marbles_color1":[0,1,1,0,1],"sequence_marbles_color2":[1,3,0,2,0],"id":"img/0375.png"}},\
{"data":{"condition":2,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/05.png"}},\
{"data":{"condition":2,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/025.png"}},\
{"data":{"condition":2,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/075.png"}},\
{"data":{"condition":2,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/0675.png"}},\
{"data":{"condition":2,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/0125.png"}},\
{"data":{"condition":2,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/0375.png"}},\
{"data":{"condition":3,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/05.png"}},\
{"data":{"condition":3,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/025.png"}},\
{"data":{"condition":3,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/075.png"}},\
{"data":{"condition":3,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/0675.png"}},\
{"data":{"condition":3,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/0125.png"}},\
{"data":{"condition":3,"sequence_marbles_color1":[9,9,9,9,9],"sequence_marbles_color2":[0,0,0,0,0],"id":"img/0375.png"}}]'
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Erstellungszeit: 12. Feb 2018 um 16:58
-- Server-Version: 10.1.30-MariaDB
-- PHP-Version: 7.1.13
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Datenbank: `GambleOCU`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `gamble`
--
CREATE TABLE `gamble` (
`rt` text COLLATE utf8_unicode_ci,
`stimulus1` text COLLATE utf8_unicode_ci,
`stimulus2` text COLLATE utf8_unicode_ci,
`key_press` text COLLATE utf8_unicode_ci,
`old_order` text COLLATE utf8_unicode_ci,
`new_order` text COLLATE utf8_unicode_ci,
`changed_Order` text COLLATE utf8_unicode_ci,
`riskyKey` text COLLATE utf8_unicode_ci,
`ChooseRisk` text COLLATE utf8_unicode_ci,
`probability` text COLLATE utf8_unicode_ci,
`valueGamble` text COLLATE utf8_unicode_ci,
`demoChoice` text COLLATE utf8_unicode_ci,
`payoff` text COLLATE utf8_unicode_ci,
`cumulatedPayoff` text COLLATE utf8_unicode_ci,
`test_part` text COLLATE utf8_unicode_ci,
`trial_type` text COLLATE utf8_unicode_ci,
`trial_index` text COLLATE utf8_unicode_ci,
`time_elapsed` text COLLATE utf8_unicode_ci,
`internal_node_id` text COLLATE utf8_unicode_ci,
`subject` text COLLATE utf8_unicode_ci,
`sex` text COLLATE utf8_unicode_ci,
`age` text COLLATE utf8_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Daten für Tabelle `gamble`
--
/**
* jspsych-html-keyboard-response
* Josh de Leeuw
*
* plugin for displaying a stimulus and getting a keyboard response
*
* documentation: docs.jspsych.org
*
**/
jsPsych.plugins["intermediatePayoff"] = (function() {
var plugin = {};
plugin.info = {
name: 'intermediatePayoff',
description: '',
parameters: {
stimulus: {
type: jsPsych.plugins.parameterType.HTML_STRING,
pretty_name: 'stimulus',
default: ":(",
description: 'The HTML string to be displayed'
},
choices: {
type: jsPsych.plugins.parameterType.KEYCODE,
array: true,
pretty_name: 'Choices',
default: jsPsych.ALL_KEYS,
description: 'The keys the subject is allowed to press to respond to the stimulus.'
},
prompt: {
type: jsPsych.plugins.parameterType.STRING,
pretty_name: 'Prompt',
default: null,
description: 'Any content here will be displayed below the stimulus.'
},
stimulus_duration: {
type: jsPsych.plugins.parameterType.INT,
pretty_name: 'Stimulus duration',
default: null,
description: 'How long to hide the stimulus.'
},
trial_duration: {
type: jsPsych.plugins.parameterType.INT,
pretty_name: 'Trial duration',
default: null,
description: 'How long to show trial before it ends.'
},
response_ends_trial: {
type: jsPsych.plugins.parameterType.BOOL,
pretty_name: 'Response ends trial',
default: true,
description: 'If true, trial will end when subject makes a response.'
},
}
}
plugin.trial = function(display_element, trial) {
var new_html = "<div id='jspsych-html-keyboard-response-stimulus'><p>Zwischenstand</p>"+
"<p>Du hast bisher "+ precisionRound(jsPsych.data.get().select('cumulatedPayoff').max(),2) +" Bonuspunkte dazu verdient!<p>" //should be possible to use max since its a cummulative value;
// add prompt
if(trial.prompt !== null){
new_html += trial.prompt;
}
// draw
display_element.innerHTML = new_html;
// store response
var response = {
rt: null,
key: null
};
// function to end trial when it is time
var end_trial = function() {
// kill any remaining setTimeout handlers
jsPsych.pluginAPI.clearAllTimeouts();
// kill keyboard listeners
if (typeof keyboardListener !== 'undefined') {
jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
}
// gather the data to store for the trial
var trial_data = {
"rt": response.rt,
"stimulus": trial.stimulus,
"key_press": response.key
};
// clear the display
display_element.innerHTML = '';
// move on to the next trial
jsPsych.finishTrial(trial_data);
};
// function to handle responses by the subject
var after_response = function(info) {
// after a valid response, the stimulus will have the CSS class 'responded'
// which can be used to provide visual feedback that a response was recorded
display_element.querySelector('#jspsych-html-keyboard-response-stimulus').className += ' responded';
// only record the first response
if (response.key == null) {
response = info;
}
if (trial.response_ends_trial) {
end_trial();
}
};
// start the response listener
if (trial.choices != jsPsych.NO_KEYS) {
var keyboardListener = jsPsych.pluginAPI.getKeyboardResponse({
callback_function: after_response,
valid_responses: trial.choices,
rt_method: 'date',
persist: false,
allow_held_key: false
});
}
// hide stimulus if stimulus_duration is set
if (trial.stimulus_duration !== null) {
jsPsych.pluginAPI.setTimeout(function() {
display_element.querySelector('#jspsych-html-keyboard-response-stimulus').style.visibility = 'hidden';
}, trial.stimulus_duration);
}
// end trial if trial_duration is set
if (trial.trial_duration !== null) {
jsPsych.pluginAPI.setTimeout(function() {
end_trial();
}, trial.trial_duration);
}
};
return plugin;
})();
/**
* jspsych-html-keyboard-response
* Josh de Leeuw
*
* plugin for displaying a stimulus and getting a keyboard response
*
* documentation: docs.jspsych.org
*
**/
jsPsych.plugins["DynamicSpecification"] = (function() {
var plugin = {};
plugin.info = {
name: 'DynamicSpecification',
description: 'This plugin saves the timelinevariables in a datastructure so i can use this as conditionals for other trials.',
parameters: {
stimulus: {
type: jsPsych.plugins.parameterType.HTML_STRING,
pretty_name: 'stimulus',
default: undefined,
description: 'The HTML string to be displayed'
},
probability: {
type: jsPsych.plugins.parameterType.STRING,
pretty_name: 'probability',
default: 'sad',
description: 'ProbabilityInfo'
},
valueGamble:{
type: jsPsych.plugins.parameterType.INT,
pretty_name: 'Value of the Gamble',
default: 5,
description: 'How much money is associated with the Gamble?'
},
condition:{
type: jsPsych.plugins.parameterType.INT,
pretty_name: 'Condition Index',
default:null
},
choices: {
type: jsPsych.plugins.parameterType.KEYCODE,
array: true,
pretty_name: 'Choices',
default: jsPsych.NO_KEYS,
description: 'The keys the subject is allowed to press to respond to the stimulus.'
},
prompt: {
type: jsPsych.plugins.parameterType.STRING,
pretty_name: 'Prompt',
default: null,
description: 'Any content here will be displayed below the stimulus.'
},
stimulus_duration: {
type: jsPsych.plugins.parameterType.INT,
pretty_name: 'Stimulus duration',
default: 1,
description: 'How long to hide the stimulus.'
},
trial_duration: {
type: jsPsych.plugins.parameterType.INT,
pretty_name: 'Trial duration',
default: 1,
description: 'How long to show trial before it ends.'
},
response_ends_trial: {
type: jsPsych.plugins.parameterType.BOOL,
pretty_name: 'Response ends trial',
default: false,
description: 'If true, trial will end when subject makes a response.'
},
}
}
plugin.trial = function(display_element, trial) {
var new_html = '<div id="jspsych-html-keyboard-response-stimulus">'+trial.stimulus+'</div>';
// add prompt
if(trial.prompt !== null){
new_html += trial.prompt;
}