Skip to content

Instantly share code, notes, and snippets.

@addisaden
Last active August 29, 2015 14:23
Show Gist options
  • Save addisaden/69b2cbc6a92fc1515e40 to your computer and use it in GitHub Desktop.
Save addisaden/69b2cbc6a92fc1515e40 to your computer and use it in GitHub Desktop.
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