MATLAB: Monte carlo simulation question

monte-carlo simulation

can anyone help me figure out whats wrong with this code. im trying to run a simulation where 3 people flip a coin if all are heads or tais they take them back. however if two coins come up heads or tails the person with the unique coin wins a coin from the other two. my problem is that my code doest follow the given conditions based on the code and instead only executes the first if statement.
a=5 % person 1 int coin b=5 % person 2 int coin c=5 % person 3 int coin d=0step=0for i=1:1:100000      t=rand() % person 1 flip       y=rand() % person 2 flip      z=rand() % person 3 flip     a=a+d      b=b+d     c=c+d     while ( (a>0 && b>0) || (b>0&& c>0)||(a>0 && c>0) || (b>0&& a>0) ||(c>0&& a>0)||(c>0&& b>0) )   step=step+1      t=rand() % person 1 flip      y=rand() % person 2 flip      z=rand() % person 3 flip      if y&&t < .5          a= a -1          b= b-1          c= c+2      elseif y&&t >.5        a= a -1          b= b-1          c= c+2      elseif z&&t < .5          a= a -1          b= b+2          c= c-1      elseif z&&t >.5        a= a -1          b= b+2          c= c-1          elseif y&&z < .5          a= a +2          b= b-1          c= c-1          elseif y&&z >.5        a= a +2          b= b-1          c= c-1      elseif z&&t&&y >.5          a=a+0          b=b+0          c=c+0      elseif z&&t&&y <.5          a=a+0          b=b+0          c=c+0          end          a=a+0      b=b+0      c=c+0      end  end  disp(a)  disp(b)  disp(c)  disp(i)

abc = [5 5 5];i = 0;while all(abc) && i <= 10000  i = i + 1;  xyz = logical(round(rand(1,3)));     if all(xyz) || ~any(xyz)    %"give the money back" by not changing scores  else    xyz = xor(xyz, sum(xyz)==1);    abc(xyz) = abc(xyz) - 1;    abc(~xyz) = abc(~xyz) + 2;  endenddisp([abc,i])