% Takes in a probability distribution D_y|x and calculates 
% and returns the expected loss in the two dice guessing game.
function loss = t2_3(y_x)

% loss found so far.
loss = 0;

% rows checked so far.
rows = 0;

for n1 = 1:6; % possibilities of first dice,
    for n2 = 1:6; % possibilities of second dice,
        x = n1 * n2;
        loss = loss + (1 - max(y_x(x,:)));
        rows = rows + 1;
    end
end

% divide accumulated loss by the amount of probability rows found.
loss = loss / rows;
