35 points In this problem we study the popular card game Bla
Solution
Code when player chooses Hit :
count = 0;
 for a = 0:1000000
    x1 = randi([1,13]);
    y1 = randi([1,13]);
    x2 = randi([1,13]);
    y2 = randi([1,13]);
    if x1 > 10
        x1 = 10;
    elseif x1 == 1
        x1 = 11;
    end
    if x2 > 10
        x2 = 10;
    elseif x2 == 1
        x2 = 11;
    end
    if y1 > 10
        y1 = 10;
    elseif y1 == 1
        y1 = 11;
    end
    if y2 > 10
        y2 = 10;
    elseif y2 == 1
        y2 = 11;
    end
    sumx = x1 + x2;
    sumy = y1 + y2;
   x3 = randi([1,13]);
    if x3 > 10
        x3 = 10;
    elseif x3 == 1
        x3 = 11;
    end
    sumx = sumx + x3;
    if sumy < 17
        y3 = randi([1,13]);
        if y3 > 10
            y3 = 10;
        elseif y3 == 1
            y3 = 11;
        end
        sumy = sumy + y3;
    end
    if sumx > sumy && sumx <= 21
        count = count+1;
    elseif sumx <= 21 && sumy > 21
        count = count+1;
    end
 end
 p = count/1000000;
 fprintf (\"Hit : %f\ \",p)
Output :
Hit : 0.235810
Code when Player chooses to Stand :
count = 0;
 for a = 0:1000000
    x1 = randi([1,13]);
    y1 = randi([1,13]);
    x2 = randi([1,13]);
    y2 = randi([1,13]);
    if x1 > 10
        x1 = 10;
    elseif x1 == 1
        x1 = 11;
    end
    if x2 > 10
        x2 = 10;
    elseif x2 == 1
        x2 = 11;
    end
    if y1 > 10
        y1 = 10;
    elseif y1 == 1
        y1 = 11;
    end
    if y2 > 10
        y2 = 10;
    elseif y2 == 1
        y2 = 11;
    end
    sumx = x1 + x2;
    sumy = y1 + y2;
   if sumy < 17
        y3 = randi([1,13]);
        if y3 > 10
            y3 = 10;
        elseif y3 == 1
            y3 = 11;
        end
        sumy = sumy + y3;
    end
    if sumx > sumy && sumx <= 21
        count = count+1;
    elseif sumx <= 21 && sumy > 21
        count = count+1;
    end
 end
 p = count/1000000;
 fprintf (\"Stand : %f\ \",p)
Output :
Stand : 0.404600
Based on the previous two estimates, the player should choose to Stand because the probabilityof winning is greater when choose to stand compared to when he choose to Hit.
![[35 points] In this problem, we study the popular card game Blackjack, also known as twenty- one. In our simplfied and modified version of the game, the dealer  [35 points] In this problem, we study the popular card game Blackjack, also known as twenty- one. In our simplfied and modified version of the game, the dealer](/WebImages/34/35-points-in-this-problem-we-study-the-popular-card-game-bla-1099708-1761580776-0.webp)
![[35 points] In this problem, we study the popular card game Blackjack, also known as twenty- one. In our simplfied and modified version of the game, the dealer  [35 points] In this problem, we study the popular card game Blackjack, also known as twenty- one. In our simplfied and modified version of the game, the dealer](/WebImages/34/35-points-in-this-problem-we-study-the-popular-card-game-bla-1099708-1761580776-1.webp)
![[35 points] In this problem, we study the popular card game Blackjack, also known as twenty- one. In our simplfied and modified version of the game, the dealer  [35 points] In this problem, we study the popular card game Blackjack, also known as twenty- one. In our simplfied and modified version of the game, the dealer](/WebImages/34/35-points-in-this-problem-we-study-the-popular-card-game-bla-1099708-1761580776-2.webp)
