JA_CFs_quickness_games_distribution.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. function [GD] = JA_CFs_quickness_games_distribution(relationship)
  2. % the function spits 4 variables
  3. % 1. games_distribution
  4. % it spits out 13 numbers. From 2:13 they represent
  5. % how many SLOW responses will be provided by CF within each game
  6. % the first game is always the wash-out game (coded as -1)
  7. % fast games
  8. % 1 game: 2 out of 9 (non catch-trials)
  9. % 2 games: 3/9
  10. % 3 games: 4/9
  11. % slow games
  12. % 1 game: 7 out of 9 (non catch-trials)
  13. % 2 games: 6/9
  14. % 3 games: 5/9
  15. % 2. CF_slow_out_of_bounds
  16. % spits out the games in which, in a slow trial CF will be too slow (4 games)
  17. % 3. CF_fast_out_of_bounds
  18. % spits out the games in which, in a fast trial CF will be too fast (4 games)
  19. % 4. CF_catch_failing_game
  20. % spits out the game in which CF fails the catch trial (1 game)
  21. %% games distribution
  22. % repmat(number of slow responses, [times,1])
  23. games_distribution_tmp = cat(1,repmat(2,[1,1]),...
  24. repmat(3,[2,1]),...
  25. repmat(4,[3,1]),...
  26. repmat(5,[3,1]),...
  27. repmat(6,[2,1]),...
  28. repmat(7,[1,1]));
  29. % randomize order of the indices going from 1 to number of 'real' games(12)
  30. idx = randperm(length(games_distribution_tmp));
  31. % apply the new order to the new variable games_distribution
  32. games_distribution = games_distribution_tmp(idx);
  33. % add the washout game as the first game to the game_distribution variable with the 0 code
  34. games_distribution = cat(1,-1, games_distribution);
  35. %%
  36. fast_games = intersect(find(games_distribution > 0),find(games_distribution < 5));
  37. slow_games = intersect(find(games_distribution > 0),find(games_distribution >= 5));
  38. wash_out_games = games_distribution < 0;
  39. games_distribution_names = cell(length(games_distribution),1);
  40. games_distribution_names(fast_games) = {'fast'};
  41. games_distribution_names(slow_games) = {'slow'};
  42. games_distribution_names(wash_out_games) = {'wash_out'};
  43. %% CF_slow_out_of_bounds
  44. tmp = randperm(length(games_distribution_tmp))+1;
  45. CF_slow_out_of_bounds_games = tmp(1:4);
  46. %% CF_fast_out_of_bounds
  47. CF_fast_out_of_bounds_games = tmp(5:8);
  48. %% CF_catch_game_failing
  49. CF_catch_failing_game = tmp(9);
  50. %% outcome feedback information (to be used into JA_outcome_feedback)
  51. outcome_feedback_relative2SBJ = size(games_distribution_names,1);
  52. SBJ_wins_distribution = zeros(size(games_distribution_names,1),1);
  53. switch relationship
  54. case 'parallel'
  55. % note that washout game is always zero
  56. % permute randomly the order of wins and lost games
  57. SBJ_wins_idx_tmp = randperm(outcome_feedback_relative2SBJ-1)+1;
  58. SBJ_wins_idx = SBJ_wins_idx_tmp(1:(outcome_feedback_relative2SBJ-1)/2);
  59. SBJ_wins_distribution(SBJ_wins_idx) = 1;
  60. case 'competitive'
  61. SBJ_wins_idx = strcmp(games_distribution_names, 'slow');
  62. SBJ_wins_distribution(SBJ_wins_idx) = 1;
  63. case 'joint'
  64. SBJ_wins_idx = strcmp(games_distribution_names, 'fast');
  65. SBJ_wins_distribution(SBJ_wins_idx) = 1;
  66. case 'imagery'
  67. SBJ_wins_idx_tmp = randperm(outcome_feedback_relative2SBJ-1)+1;
  68. SBJ_wins_idx = SBJ_wins_idx_tmp(1:(outcome_feedback_relative2SBJ-1)/2);
  69. SBJ_wins_distribution(SBJ_wins_idx) = 1;
  70. case 'warming_up'
  71. case 'training'
  72. end
  73. %%
  74. GD.games_distribution = games_distribution;
  75. GD.games_distribution_names = games_distribution_names;
  76. GD.CF_slow_out_of_bounds_games = CF_slow_out_of_bounds_games;
  77. GD.CF_fast_out_of_bounds_games = CF_fast_out_of_bounds_games;
  78. GD.CF_catch_failing_game = CF_catch_failing_game;
  79. GD.SBJ_wins_distribution = SBJ_wins_distribution;
  80. end