notes/Monty Hall Problem-WmmQvNLv.html
<html>
	<head>
		<script>
			function go(){
				st=0; //count the number of wins with staying
				sw=0; //count the number of wins with switching

				door = new Array("Win","Lose","Lose"); //Create 3 Doors

	
				document.getElementById('output').innerHTML="Stay Wins -- Switching Wins<hr>";
	
				for(i=0;i<100;i++){
					output=document.getElementById('output').innerHTML;
					x=Math.floor(Math.random() * 3); //pick a random door
	
					p=door[x];

					if(x==1){
						s="lose";
						st++;
					}else{
						s="win";
						sw++;
					}
					document.getElementById('output').innerHTML=output + p + " -- " + s + "<br>\n";
				};

				m1="Staying will win " + st + " of the time.\n"; 
				m2="Switching will win " + sw + " of the time.\n"; 
				document.getElementById('output').innerHTML=output + "<hr>" + m1 + m2;
			}
		</script>
	</head>
	<body onload="go()" >
		<div id="output"></div>
	</body>
</html>

syntax highlighted by Code2HTML, v. 0.9.1