function [InfoSeq,ParitySeq,codebook] = BlockCode(n,k)
seq = 'UAAGGAGGUGAUC';

% to generate the Information Bases:
Alphabet = 'AGCU';
switch k
    case 1,
        for i = 1:4
            InfoSeq{i,1} = Alphabet(i);
            InfoSeq{i,2} = modulo5(InfoSeq{i,1});
        end
    case 2,
        d = 1;
        for i = 1:4
            for j = 1:4
                InfoSeq{d,1} = strcat(Alphabet(i),Alphabet(j));
                InfoSeq{d,2} = modulo5(InfoSeq{d,1});
                d = d + 1;
            end
        end
    case 3,
        d = 1;
        for i = 1:4
            for j = 1:4
                for m = 1:4
                    InfoSeq{d,1} = strcat(Alphabet(i),Alphabet(j),Alphabet(m));
                    InfoSeq{d,2} = modulo5(InfoSeq{d,1});
                    d = d + 1;
                end
            end
        end
    case 4,
        d = 1;
        for i = 1:4
            for j = 1:4
                for m = 1:4
                    for p = 1:4
                        InfoSeq{d,1} = strcat(Alphabet(i),Alphabet(j),Alphabet(m),Alphabet(p));
                        InfoSeq{d,2} = modulo5(InfoSeq{d,1});
                        d = d + 1;
                    end
                end
            end
        end
end

% to generate the Parity Bases:
for i = 1:13 - (n - k) + 1
    ParitySeq{i,1} = seq(i:i+ n - k - 1);
    ParitySeq{i,2} = modulo5(ParitySeq{i,1});
end

q = 1;
for i = 1:length(ParitySeq)
    ParitySeqq{q,1} = ParitySeq{i,1};
    ParitySeqq{q,2} = modulo5(ParitySeqq{q,1});
    ParitySeqq{q,3} = 'OK';
    if i>=2,
        for j = 1:i-1
            if ParitySeq{j,1} == ParitySeqq{q,1}, ParitySeqq{q,3} = 'X'; end
        end
    end
    q = q + 1;
end


clear ParitySeq;
q = 1;
for i = 1:length(ParitySeqq)
    if ParitySeqq{i,3} == 'OK', 
        ParitySeq{q,1} = ParitySeqq{i,1};
        ParitySeq{q,2} = ParitySeqq{i,2};
        q = q + 1;
    end
end

    

m = 1;
for i = 1:length(InfoSeq)
    num1 = cell2mat(InfoSeq(i,2));
    if num1 == 0, num1 = 5; end
    x = find(cell2mat(ParitySeq(:,2)) == 5 - num1); % a vector of the values in ParitySeq that are modulo 5 to InforSeq.
    for  j = 1:length(x)
        codeword(m) = strcat(InfoSeq(i,1),ParitySeq(x(j),1));
        m = m + 1;
    end
end
codebook = codeword';






