% initialize the task structure function [disp_struct, task_struct] = taskInit(disp_struct, task_struct, SCREENS, session, LEFTKEY, RIGHTKEY) % structure to hold data pertinant to the task task_data = struct(); % set up the matrix columns task_struct.cBlock = 1; task_struct.cTrialNum = 2; task_struct.cTrialID = 3; task_struct.cTrialCond = 4; task_struct.cTrialType = 5; task_struct.cS1 = 6; task_struct.cS1Rew = 7; task_struct.cS2 = 8; task_struct.cS2Rew = 9; task_struct.cIsS1Left = 10; task_struct.cRespAct = 11; task_struct.cMatch = 12; task_struct.cRespRew = 13; task_struct.cRT = 14; % maximum trial gap between free-choice and its no-choice pair task_struct.maxGap = 7; % code for each stimulus task_struct.sCodes = struct('Afc', 1, 'Bfc', 2, 'Cfc', 3, 'Dfc', 4, 'Anc', 5, 'Bnc', 6, 'Cnc', 7, 'Dnc', 8); % the reward probabilities for each stim task_struct.pWin = [0.9 0.1 0.7 0.3 0.9 0.1 0.7 0.3]; % JFC changed to 90/10 and 70/30 % number of reps for each stimulus pair per training block task_struct.numTrainReps = 10; task_struct.numTestBiasReps = 10; task_struct.numTestABReps = 4; task_struct.numTestTrainReps = 4; % index to match each free-choice with it's no-choice stim pair task_struct.ncAdjust = 4; % max response time task_struct.maxRT = 4; % training performance thresholds task_struct.minPerf = [0.60 0.60]; % min/max number of training blocks task_struct.minTrain = 3; task_struct.maxTrain = 5; % condition flags for each trial type task_struct.NC = 0; task_struct.FC = 1; task_struct.PRAC = -1; task_struct.TRAIN = 0; task_struct.TEST = 1; task_struct.WIN = 1; task_struct.LOSS = 0; % set up the response keys disp_struct.RESP_L = LEFTKEY; disp_struct.RESP_R = RIGHTKEY; disp_struct.RESP_SLOW = -1; % first set up the display window % screenRect_debug = [0,0,1000,800]; % screen for debugging screenRect_task = []; % full screen % open the window [wPtr,rect] = Screen('OpenWindow', SCREENS, [], screenRect_task); % store the display window and it's bounds disp_struct.wPtr = wPtr; disp_struct.wPtr_rect = rect; % load the images if session==1 cardNames = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'I', 'J', 'K', 'L'}; % Practice stims repeated here b/c of laziness elseif session==2 cardNames = {'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'I', 'J', 'K', 'L', 'I', 'J', 'K', 'L'}; % Practice stims repeated here b/c of laziness else disp(' '); disp(' '); disp(' '); disp('Enter a 1 or a 2 for session!'); disp(' '); end disp_struct.cards = nan(length(cardNames), 1); for imgI = 1 : length(cardNames) disp_struct.cards(imgI) = Screen('MakeTexture', disp_struct.wPtr, imread(fullfile('..', 'images', [cardNames{imgI},'.bmp']))); end % for each card % randomize the first 8 (I,J,K,L are for practice) disp_struct.cards(1:length(task_struct.pWin)) = disp_struct.cards(randperm(length(task_struct.pWin))); end % function