Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,22 @@
keepWins := 0
switchWins := 0
doors := 3
times := 100000
pickDoor := method(excludeA, excludeB,
door := excludeA
while(door == excludeA or door == excludeB,
door = (Random value() * doors) floor
)
door
)
times repeat(
playerChoice := pickDoor()
carDoor := pickDoor()
shownDoor := pickDoor(carDoor, playerChoice)
switchDoor := pickDoor(playerChoice, shownDoor)
(playerChoice == carDoor) ifTrue(keepWins = keepWins + 1)
(switchDoor == carDoor) ifTrue(switchWins = switchWins + 1)
)
("Switching to the other door won #{switchWins} times.\n"\
.. "Keeping the same door won #{keepWins} times.\n"\
.. "Game played #{times} times with #{doors} doors.") interpolate println