'adapted from BASIC solution DIM doors(3) '0 is a goat, 1 is a car total = 10000 'set desired number of iterations switchWins = 0 stayWins = 0 FOR plays = 1 TO total winner = INT(RND(1) * 3) + 1 doors(winner) = 1'put a winner in a random door choice = INT(RND(1) * 3) + 1'pick a door, any door DO shown = INT(RND(1) * 3) + 1 'don't show the winner or the choice LOOP WHILE doors(shown) = 1 OR shown = choice if doors(choice) = 1 then stayWins = stayWins + 1 'if you won by staying, count it else switchWins = switchWins + 1'could have switched to win end if doors(winner) = 0 'clear the doors for the next test NEXT PRINT "Result for ";total;" games." PRINT "Switching wins "; switchWins; " times." PRINT "Staying wins "; stayWins; " times."