Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created May 10, 2012 06:50
Show Gist options
  • Save jasonLaster/2651524 to your computer and use it in GitHub Desktop.
Save jasonLaster/2651524 to your computer and use it in GitHub Desktop.
%data
%human_data = ...
%comp_data = ...
% find the number of rounds played
hrounds = size(human_data,1);
crounds = size(comp_data,1);
% find the beginning of the different games
first_col = @(data, ncols) data(data < ncols);
hbeginnings = first_col(find(human_data==9), hrounds);
cbeginnings = first_col(find(comp_data==9), crounds);
% build a sequence of rounds plays without beginnings
human_seq = human_data; human_seq(hbeginnings,:) = [];
comp_seq = comp_data; comp_seq(cbeginnings,:) = [];
if true
% human distribution
hdisti = @(n) size(find(human_seq == n),1);
hdist = cell2mat(arrayfun(hdisti, 1:3, 'UniformOutput',false));
% computer distribution
cdisti = @(n) size(find(comp_seq(:,1) == n),1);
cdist = cell2mat(arrayfun(cdisti, 1:3, 'UniformOutput',false));
% total distribution
tdist = hdist + cdist
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment