% function child = OneChild(mom,dad)
%
% Inputs:
%   mom = genotype of mother**
%   dad = genotype of father**
% ** For genotypes use
%     1 for heterozygous, Aa or aA
%     2 for homozygous dominant, AA
%     3 for homozygous recessive, aa
%
% Output:
%   child = genotype of offspring
function child = OneChild(mom,dad)


% Within this function we will use
%   0 to represent a recessive allele
%   1 to represent a dominant allele

% Determine allele inherited from mother
if mom == 1     
    %if mom heterozygous, randomly choose between two alleles
    childallele1 = floor(2*rand(1));
elseif mom == 2
    %if mom homozygous dominant, then child inherits A
    childallele1 = 1;
else
    %if mom homozygous dominant, then child inherits a
    childallele1 = 0;
end

% Determine alleler inherited from father
if dad == 1     
    %if dad heterozygous, randomly choose between two alleles
    childallele2 = floor(2*rand(1));
elseif dad == 2
    %if dad homozygous dominant, then child inherits A
    childallele2 = 1;
else
    %if dad homozygous dominant, then child inherits a
    childallele2 = 0;
end

% Determine the genotype of the child
if (childallele1 == 1 && childallele2==1)
    child = 2;
elseif (childallele1==0 && childallele2==0)
    child = 3;
else
    child = 1;
end

