unfairFlip - Eric Young CS 100 M Script unfairFlip.m c clc...

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

View Full Document Right Arrow Icon
% Eric Young % CS 100 M % Script unfairFlip.m % clc c % Intiliaze variables: annWins, bobWins, and # of trials all start at 0 % annWins = 0; bobWins = 0; b trials = 0; t % Outer loop stops when one of them has 5 wins or there have been more than % 30 trials % w annWinsTrial = false; bobWinsTrial = false; % First repetition through loop is Ann; second, Bob for n = 1:2 coinflip1 = rand; % Random number represents coin flip coinflip2 = rand; % Random number represents 2nd flip % If Ann goes and gets two tails, annWinsTrial gets value 1 % Else, if Bob goes and gets HT or TH, bobWinsTrial gets value 1
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/12/2009 for the course CS 100 taught by Professor Fan/vanloan during the Fall '07 term at Cornell.

Ask a homework question - tutors are online