Skip to content

Instantly share code, notes, and snippets.

@usptact
Last active October 25, 2018 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usptact/94b26d20fea8afe19058f9f76b4d0896 to your computer and use it in GitHub Desktop.
Save usptact/94b26d20fea8afe19058f9f76b4d0896 to your computer and use it in GitHub Desktop.
//
// Game of Ur
//
var roll = function() {
return flip() + flip() + flip() + flip();
}
var game = function() {
var n = sample(RandomInteger({n: 20}));
var s = sum(repeat(n, roll))
condition(s === 13);
return n
}
var dist = Infer(game);
viz(dist);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment