Last active
December 28, 2016 17:14
-
-
Save Randgalt/9bd1de087d40b7ee9b10f2e6fec728e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var wouldWinIfSwitch = 0; | |
var wouldLoseIfSwitch = 0; | |
var gameQty = 0; | |
function runGame() { | |
var prizeDoor = Math.floor(3 * Math.random()); | |
var guessDoor = Math.floor(3 * Math.random()); | |
var firstGuessIsRight = (guessDoor === prizeDoor); | |
if ( firstGuessIsRight ) { | |
++wouldLoseIfSwitch; | |
} else { | |
++wouldWinIfSwitch; | |
} | |
++gameQty; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment