% 血液型の分布を解析的に計算

set_Caa_Cao_Coo_Cbb_Cbo_Cab;

%dist = [ 0.2, 0.2, 0.3, 0.1, 0.1, 0.1 ];
%dist = [ 0.1, 0.3, 0.3, 0.05, 0.15 0.1 ];
dist = [ 0.08, 0.32, 0.3, 0.04, 0.16 0.1 ];
%dist = [ 0.1, 0.1, 0.3, 0.1, 0.1, 0.3 ];
%dist = [ 0.1, 0.1, 0.5, 0.1, 0.1, 0.1 ];

fprintf("%2d:  ", 0);
fprintf("%.5f  ", dist);
fprintf("\n");

for gen=1:5
    distnext = zeros(1,6);
    distnext(1) = dist*Caa*dist';
    distnext(2) = dist*Cao*dist';
    distnext(3) = dist*Coo*dist';
    distnext(4) = dist*Cbb*dist';
    distnext(5) = dist*Cbo*dist';
    distnext(6) = dist*Cab*dist';
    dist = distnext;
    fprintf("%2d:  ", gen);
    fprintf("%.5f  ", dist);
    fprintf("\n"); 
end
