M3Helpers = {}

function M3Helpers.createComboInfo()
    local info = {}
    
    info.count     = 0
    info.colCounts = {}
    info.rowCounts = {}
    
    info.add = function(col, row)
        info.count = info.count + 1
        info.colCounts[col] = (info.colCounts[col] ~= nil) and (info.colCounts[col] + 1) or 1
        info.rowCounts[row] = (info.rowCounts[row] ~= nil) and (info.rowCounts[row] + 1) or 1
    end
    
    info.getCenter = function()
        local col, row
        
        local maxCount = 0
        for index, count in pairs(info.colCounts) do
            if count > maxCount then
                col = index
                maxCount = count
            end
        end
        
        maxCount = 0
        for index, count in pairs(info.rowCounts) do
            if count > maxCount then
                row = index
                maxCount = count
            end
        end
        
        return col, row
    end
    
    
    return info
end