function M = CS6380_show_trace(num_rows,num_cols,trace)
% CS6380_show_trace - make movie of random robot behavior
% On input:
%     num_rows (int): number of rows for grid
%     num_cols (int): number of cols for grid
%     trace (max_timex(2*n) array): location of agents
%         each row has: r_1,c_1, r_2,c_2, ..., r_n,c_n coordinates
% On output:
%     M (movie): movie of agent movement in grid
% Call:
%     M = Cs6380_show_trace(20,20,t20);
% Author:
%     T. Henderson
%     Summer 2014
%     UU
%

clf
[num_steps,num_agents2] = size(trace);
num_agents = num_agents2/2;
hold on
for s = 1:num_steps
    im = zeros(num_rows,num_cols);
    cols = trace(s,2:2:end);
    rows = trace(s,1:2:end-1);
    for a = 1:num_agents
        im(rows(a),cols(a)) = 1;
    end
    im2 = imresize(im,[100,100],'nearest');
    imshow(im2);
    clear im2
    M(s) = getframe;
end
