Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suzy has received $15,000 in inheritance and would like to increase her asset by

ID: 3664702 • Letter: S

Question

Suzy has received $15,000 in inheritance and would like to increase her asset by playing her favorite game is craps, and two of her favorite casinos offer different betting options. Casino 1 offers a $100 minimum bet, $500 maximum bet and Casino 2 offers a $300 minimum bet, $1,500 maximum bet. To simplify things, she will play only the minimum or maximum and she will bet one hand at a time. She wants to you to determine which casino she should use and whether she should bet the minimum or maximum. [Note: To keep things simple for her, she has requested to make only one bet per dice roll. If she does not lose or win, her chips are taken off the board and a new bet is made.]

1. Pass Line bet

a. 7 or 11 = win (1:1; double your bet)

b. 2, 3, or 12 = lose your bet

c. any other number = nothing happens

Using a MATLAB program, run a simulation to show which option will give her the best probability to increase her asset to $20,000 or more.

Explanation / Answer

Bet.m:

Result.m:

function [win, lose] = bet_result(blank, rolling);
win= blank(1,1);
lose=blank(1,2);
%display times won, lost, or roll again
disp(['You won ', num2str(win), ' times. You lost ', num2str(lose), ' times.' ])
disp(['You have $',num2str(rolling)])

rules.m:

function crap_rules
disp('Craps is a dice game played with 2 die. The player begins by making first roll: If the roll is a 7 or 11 ? Player wins ? If the roll is a 2, 3, or 12 ? Player loses. Otherwise the player continues rolling:If after the first roll, the player rolls a 7 ? Player loses. If the player rolls the same total as the first roll ? Player wins. Player continues rolling until the first roll is repeated or a 7 is rolled. Player can start game with any amount of money, and can bet any amount (<= total) for each game, until out of money.')
end

main.m

function crapmain
crap_rules
%initial variables
repeat = 1;
blank= zeros(1,2);
rolling = 0;
rolling= rolling + input('How much money do you have $');

%[repeat, blank, rolling] = bet_amount(repeat, blank, rolling );
while repeat ==1
repeat = menu('What would you like to do?' , 'Roll dice', 'End');
  
while repeat ==1
money= 0;
while money == 0
%asking how much money to bet
money = input('How much money would you like to bet? $');
%checking if money bet is valid
if rolling +1 >= money && money >0
  
  
[sum_roll] = twodie; %calls function to return the sum of roll of two dice

if sum_roll == 7 || sum_roll == 11
first_roll = 1;
disp('YOU WIN')
blank(1) = blank(1,1) +1;
rolling = rolling + money;

elseif sum_roll == 2 || sum_roll == 3 || sum_roll == 12
first_roll = 2;
disp('SORRY, YOU LOSE')
blank(2) = blank(1,2) +1;
rolling = rolling - money;
else
first_roll = 0;
first_roll_sum = sum_roll;
end
  
while first_roll == 0
[sum_roll] = twodie;
if sum_roll == first_roll_sum
disp('YOU WIN')
first_roll = 1;
blank(1) = blank(1,1) +1;
rolling = rolling + money;
elseif sum_roll == 7
disp('SORRY, YOU LOSE')
first_roll = 2;
blank(2) = blank(1,2) +1;
rolling = rolling - money;
else
first_roll =0;
end
end
  
  
  
%Variables to be used in display
win= blank(1,1);
lose=blank(1,2);
%display times won, lost, or roll again
disp(['You won ', num2str(win), ' times. You lost ', num2str(lose), ' times.' ])
disp(['You have $',num2str(rolling)])

  

else
disp('Re-enter money to wager. Try again Please.')
end
  
end
repeat = menu('What would you like to do?' , 'Roll dice', 'End');
  
end
if repeat == 2
disp('Thank you for playing')
end
  
end
end

die.m

function [repeat, blank, rolling] = bet_amount(repeat, blank, rolling ) while repeat ==1 repeat = menu('What would you like to do?' , 'Roll dice', 'End'); while repeat ==1 money= 0; while money == 0 %asking how much money to bet money = input('How much money would you like to bet? $'); %checking if money bet is valid if rolling +1 >= money && money >0 game_result =0; while game_result ==0 [sum_roll] = twodie; %calls function to return the sum of roll of two dice if sum_roll == 7 || sum_roll == 11 game_result = 1; disp('YOU WIN') blank(1) = blank(1,1) +1; rolling = rolling + money; elseif sum_roll == 2 || sum_roll == 3 || sum_roll == 12 game_result = 2; disp('SORRY, YOU LOSE') blank(2) = blank(1,2) +1; rolling = rolling - money; else game_result = 0; end %Variables to be used in display [win, lose] = bet_result(blank, rolling); % win= blank(1,1); % lose=blank(1,2); % %display times won, lost, or roll again % disp(['You won ', num2str(win), ' times. You lost ', num2str(lose), ' times.' ]) % disp(['You have $',num2str(rolling)]) % end else disp('Re-enter money to wager. Try again Please.') end end repeat = menu('What would you like to do?' , 'Roll dice', 'End'); end if repeat == 2 disp('Thank you for playing') end end end