% nstates.m
%
% compute number of states
%
% based on vit/setup_combos.m
%
function nstates( MM_max, K)

global combos;
global M;

combos = combinations( 1:MM_max, K);

for i = K-1:-1:1
  tc = combinations( 1:MM_max, i);
  tc = [tc; (MM_max+1)*ones(K-i,size(tc,2))];	% K-i missed target events
  combos = [combos, tc];
end

combos = [combos, (MM_max+1)*ones(K,1)];	% K missed target events

M = size(combos,2);
