Anonymous user
Monty Hall problem: Difference between revisions
→{{header|ActionScript}}
(→{{header|Java}}: fixed logic) |
|||
Line 12:
import flash.display.Sprite;
public class
{
public function
{
var iterations:int = 30000;
var switchWins:int = 0;
var stayWins:int = 0;
Line 23 ⟶ 22:
for (var i:int = 0; i < iterations; i++)
{
var doors
var choice:int = Math.floor(Math.random() * 3);
var shown:int;
do
{
shown = Math.
} while (doors[shown]
stayWins += doors[choice];
switchWins +=
}
|