China Naming Network - Ziwei Dou Shu - Matlab random lottery program

Matlab random lottery program

Disp (please enter yes at the beginning of ['and No at the beginning]);

Rock breaking = devotion ('Shall we start?' ,' s ');

If Shikai = =' Yes'

A1=1+(6-1) * round (rand (1));

A2= 1+(6- 1)*round (rand (1));

a3 = a 1+a2;

If a3==3||a3== 1 1

Disp([' the bettor wins']);

Disp([' because the first dice value =', num2str(a 1),'; The second =', num2str(a2),'; Sum of the two =', num2str (a3)]);

else if a3 = = 2 | | a3 = = 7 | | a3 = = 12

Disp([' the bettor lost']);

Disp([' because the first dice value =', num2str(a 1),'; The second =', num2str(a2),'; Sum of the two =', num2str (a3)]);

else if a3 = = 4 | | a3 = = 5 | | a3 = = 6 | | a3 = = 8 | | a3 = = 9 | | a3 = = 10

k = a3

k 1 = 1;

And k>0

k 1 = k 1+ 1;

Disp([' the first', num2str (k1-kloc-0/),' the result of the second throw:',' the first dice value =', num2str(a 1),'; The second =', num2str(a2),'; Sum of the two =', num2str (a3)]);

Disp([' no winner, always losing, losing', num2str(k 1- 1),' times']);

A1=1+(6-1) * round (rand (1));

A2= 1+(6- 1)*round (rand (1));

a3 = a 1+a2;

If a3==k

Disp([' Haha, the gambler won']);

Disp([' because of the first', num2str(k 1),' the result of the second throw is:',' the first dice value =', num2str(a 1),'; The second =', num2str(a2),'; Sum of the two =', num2str (a3)]);

Break;

elseif a3==7

Disp([' Alas, the gambler lost']);

Disp([' because of the first', num2str(k 1),' the result of the second throw is:',' the first dice value =', num2str(a 1),'; The second =', num2str(a2),'; Sum of the two =', num2str (a3)]);

Break;

end

end

end

end