Azzera filtri
Azzera filtri

how can i write an m-file function that stimulates one or more dice with each die giving values from 1 to 6?

1 visualizzazione (ultimi 30 giorni)
.
  6 Commenti
Rola Zayn
Rola Zayn il 21 Dic 2016
Modificato: Rola Zayn il 21 Dic 2016
then why close my question? iam merely not familiar with this type of exercise so iam asking what course of action shall i take i dont want a ready solution i want someone to explain what i should do..as is the point of this whole community.
Walter Roberson
Walter Roberson il 21 Dic 2016
I closed it accidentally because I did not read the posters name closely enough and thought it was a duplicate question. I noticed a few seconds later and re-opened it.

Accedi per commentare.

Risposte (2)

Walter Roberson
Walter Roberson il 21 Dic 2016
"i just don't know how to write the stipulation"
randi(6)
  4 Commenti

Accedi per commentare.


Image Analyst
Image Analyst il 22 Dic 2016
Modificato: Image Analyst il 22 Dic 2016
My only dice demo is one that I wrote demonstrating the Einstein Oppenheimer dice game. It's a fascinating puzzle or paradox that I think everyone will find truly intriguing. The relevant "die rolling" line is this:
sides = randi(6, 1, 2); % Roll two six-sided dice
Here is the description at the beginning:
% Intransitive dice - "rock paper scissors" dice.
% http://tierneylab.blogs.nytimes.com/2009/03/30/the-god-einstein-oppenheimer-dice-puzzle/
%
% God does not throw dice, Albert Einstein famously declared, but suppose he was wrong.
% Suppose God decided to demonstrate otherwise by showing up one day at the Institute for Advanced Study.
% God announces that dice games are in fact wildly popular in heaven,
% and that the purpose of this visit it to teach a new game to Einstein and J. Robert Oppenheimer. God explains the rules:
% There are three blank dice. First, Oppenheimer will take each of the six-sided dice
% and write the numbers from 1 to 18, in any order he likes, on the 18 faces of the three dice.
% Einstein will then examine the dice and select one of them as his own.
% Oppenheimer will then examine the remaining two dice and select one of them.
% (The third die will be discarded.) Oppenheimer and Einstein will then play repeated rounds
% of “Dice War” in which they roll the dice simultaneously, with a point being awarded each round
% to the player who rolls the higher number. The player with the most points wins.
% Assume that Oppenheimer and Einstein employ the smartest possible strategies,
% and that the outcome will be determined by the laws of probability (meaning that God doesn’t skew the dice
% or the influence the rolls). Which player, if either, is favored to win?
%
% Essentially, Oppenheimer creates a set of 3 "rock paper scissor" dice,
% ensuring that whichever one die Einstein chooses, Oppenheimer can pick one of the
% other two dice that will, on average, beat the die Einstein chose.
%
% The question is then, can we create a set of ‘rock paper scissor’ dice? We can, and the set is:
%
% 18 17 10 9 2 1 for the first die;
% 16 15 8 7 6 5 for the second;
% 14 13 12 11 4 3 for the third.
%
% Die 1 will beat die 2 on average 5/9ths of the time, but will lose 5/9ths of the time to die 3.
% Die 2 will beat die 3 on average 5/9ths of the time, but will lose 5/9ths of the time to die 1.
% Die 3 will beat die 1 on average 5/9ths of the time, but will lose 5/9ths of the time to die 2.
%
% Therefore, whichever die Einstein chooses, Oppenheimer can pick one such
% that he will win on average 5/9ths of the time.
% — Ioan Wigmore
%
% MATLAB code by Image Analyst
I do have some fun demos on random walks and Monte Carlo simulations (like the famous Monty Hall problem) if you're interested - just ask.

Categorie

Scopri di più su Board games in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by