stressTest - wins2 = 0; ties = 0; % Check stats wins1 =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [] = stressTest (bot1, bot2, map, iters) % Runs iters# of rounds and reports results global TIME; global WALLTIME; global AVOIDTIME; global DETERMINETIME; global CHASETIME; records = zeros(1, iters); gameTime = []; % Run rounds for roundOn = 1:iters percRun = round(roundOn/iters*10000)/100; clc disp(['Progress: ' num2str(percRun) '% complete. ..']) tic [winner, err, errstr] = battle4(bot1, bot2, 0, map); gameTime = [gameTime, toc]; if isempty(errstr) records(roundOn) = winner; else assignin('base', 'err', err); assignin('base', 'errstr', errstr); end end % Sum and show statistics wins1 = 0;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: wins2 = 0; ties = 0; % Check stats wins1 = wins1 + length(find(records == 1)); wins2 = wins2 + length(find(records == 2)); ties = ties + length(find(records == 0)); perc1 = wins1/iters*100; perc2 = wins2/iters*100; perc0 = ties/iters; % Display statistics disp (['Out of ' num2str(iters) ' games']) disp (['Robot 1 won: ' num2str(perc1) ' percent, with ' num2str(wins1) ' games.']) disp (['Robot 2 won: ' num2str(perc2) ' percent, with ' num2str(wins2) ' games.']) disp ([num2str(perc0) ' percent of the games tied, at ' num2str(ties) ' games.'])...
View Full Document

Ask a homework question - tutors are online