Code covered by the BSD License
-
armyantsimulator(contestAntFH...
MATLAB 2008 Army Ants Contest
-
getComplexity(filename)
GETCOMPLEXITY Calculate the maximum complexity in an M-file.
-
grade(main,foodStart,red,blac...
Copyright 2008 The MathWorks, Inc.
-
house_solver(mainMap,foodMap,...
Copyright 2008 The MathWorks, Inc.
-
runcontest(drawboard,doBoards)
RUNCONTEST Test an entry.
-
solver(mainMap,foodMap,myAntM...
Copyright 2008 The MathWorks, Inc.
-
View all files
from
MATLAB Contest - Army Ants
by The MATLAB Contest Team
All the files needed to develop and score an entry for the MATLABĀ® Programming Contest.
|
| getComplexity(filename) |
function maxComplexity = getComplexity(filename)
%GETCOMPLEXITY Calculate the maximum complexity in an M-file.
% maxComplexity = getComplexity(filename)
%
% "Complexity" refers to the McCabe complexity as returned by "mlint -cyc"
% When there are multiple functions in a file, the maximum value is
% returned.
% Copyright 2008 The MathWorks, Inc.
msg = mlint('-cyc','-string',filename);
tk = regexp(msg,'McCabe complexity of [^\s]+ is (\d+)','tokens');
complexity = zeros(size(tk));
for j = 1:length(tk)
complexity(j) = eval(tk{j}{1});
end
maxComplexity = max(complexity);
|
|
Contact us at files@mathworks.com