HW1 - Math98 HW1 : due September 8 Here is a simple game: a...

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Math98 HW1 : due September 8 Here is a simple game: a player can roll a fair, six-sided die up to three times. After each roll a player may stop the game and receive $1 for each dot on the upturned die. The player has to roll at least once, and the game automatically stops after the third roll. For example, if a player rolls 1, rolls 4, and then stops, the player receives $4 . The purpose of this exercise is to determine a good strategy to play this game, one that maximizes the chances of winning the most money. a. The MATLAB command rand yields a uniformly distributed, random number between 0 and 1. Therefore the statement ceil(6*rand) provides a 1 , 2 , 3 , 4 , 5 or 6 each with probability 1 / 6. We may thus interpret the result of the above MATLAB statement to be the occurrence of a roll of a fair, six-sided die. Use the above command to simulate rolls of a die when you implement a MATLAB function of the form function Strategy(minFirstRoll,minSecRoll) ....
View Full Document

This note was uploaded on 01/21/2012 for the course MATH 98 taught by Professor Instuctor during the Spring '08 term at Berkeley.

Ask a homework question - tutors are online