Last active
August 29, 2015 14:23
-
-
Save addisaden/69b2cbc6a92fc1515e40 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 w20 = function(x, y) { | |
var wurf = Math.floor(Math.random() * 20) + 1; | |
var mustbe = Math.floor(20 - 20 * x / y) + 1; | |
return {wurf: wurf, mustbe: mustbe, result: wurf >= mustbe}; | |
}; | |
for(var y = 1; y <= 20; y++) { | |
for(var x = 1; x <= y; x++) { | |
var result; | |
do { | |
result = w20(x, y); | |
console.log(x + "/" + y + ": " + result.wurf + ", " + result.mustbe + ", " + result.result); | |
} while (result.result === false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment