1/4 10/49

このエントリーをはてなブックマークに追加
<HTML><HEAD><TITLE>1/4とか逝ってるヤシは池沼</TITLE></HEAD><BODY><SCRIPT language="JavaScript">
<!--
function draw(cards) {
do { c = Math.floor((13*4)* Math.random());
if (cards[c]!=null) {drawed = cards[c];cards[c] = null;return drawed;}
} while (true);
}
function ransuu(form1) {
form1.disp.value = ""; TimesDiaInBox = 0;
for (n=0; n<form1.kaisu.value; ++n) {
cards = new Array( "S1","S2","S3","S4","S5","S6","S7","S8","S9","S10","S11","S12","S13",
"H1","H2","H3","H4","H5","H6","H7","H8","H9","H10","H11","H12","H13",
"C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","C11","C12","C13",
"D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","D11","D12","D13");
inBoxCard = draw(cards);//One card was into a box.

//Three cards ware all dias.
notTheCase = false;
for (m=0; m<3; m++) {
opened = draw(cards);
if (opened.charAt(0)!='D') {notTheCase = true; break; }
}
if (notTheCase==true){ --n; continue;}

//Is the card was dia?
if (inBoxCard.charAt(0)=='D') { TimesDiaInBox++; }
form1.disp.value = "In the Box was :"+inBoxCard + "\n "+ TimesDiaInBox + " / " + (n+1) + "\n";
}
}
//-->
</SCRIPT><P>実験</P><FORM><INPUT size="10" type="text" name="kaisu"> 回<INPUT type="button" value="go" onclick="ransuu(this.form);"><BR>
<TEXTAREA rows="4" cols="20" name="disp"></TEXTAREA></FORM></BODY></HTML>