function [ patterns ] = GeneratePatterns( maximumAliasingOrder, numOfCombinations )
% Hassan Nahas
%This function generates all possible combinations of words that are size
%numOfCombinations and base maximumAliasingOrder.
    L = maximumAliasingOrder;



    lengthOfNumber = numOfCombinations; %size(TxRxCombinationIndicesToTest,2);
    availableChars = -L:1:L;



    numOfPatterns = (2*L + 1)^(lengthOfNumber);


    allG = zeros([numOfPatterns,lengthOfNumber]);

    for i = 1:lengthOfNumber

        numOfEachDigit = size(availableChars,2)^(lengthOfNumber-i);
        numOfPatternRepeat = size(availableChars,2)^(i-1);

        indexinAllG = 0;
        for iterationOfPattern = 1:numOfPatternRepeat
            for char = availableChars
                for digitInPattern = 1:numOfEachDigit
                    indexinAllG = indexinAllG + 1;
                    allG(indexinAllG,i) = char;
                end
            end
        end
    end
    
    patterns = allG';

end

