POV-Ray : Newsgroups : povray.off-topic : Interesting dice problem : Re: Interesting dice problem Server Time
6 Sep 2024 03:14:25 EDT (-0400)
  Re: Interesting dice problem  
From: John VanSickle
Date: 15 May 2009 20:40:49
Message: <4a0e0b91$1@news.povray.org>
Warp wrote:
>   The rock-paper-scissors game between two people can substitute coin-tossing:
> It's played until one of them wins, and that's equivalent to tossing a coin
> to see who wins. (Let's forget about the slight non-randomness of human
> behavior in this context. It's not the point here.)
> 
>   This method of deciding between two things at random between to people
> (or two groups of people, eg. teams) is often used when there's no proper
> equipment available (in this case a coin).
> 
>   Another way of putting it: Two people playing rock-paper-scissors once
> (ie. until one of them wins) is equivalent to rolling a 1d2: If the first
> person wins, it's like rolling a 1, and if the second person wins, it's
> like rolling a 2.
> 
>   This gave me an idea for a small thinking problem:
> 
> - How should two people play rock-paper-scissors in such way that it's
> completely equivalent to rolling a 1d6? Or is it theoretically even
> possible?

Take the first three results from RPS, represented as A or B, and follow 
the rules as given here:

A-A-A:  generate a 1 from a 1d6.
A-A-B:  Continue to play until one player repeats as a winner (including 
the result from the third game just played).  If A wins, the 1d6 result 
is 1.  If B wins, the 1d6 result is 2.
A-B-A:  Continue to play until one player repeats.  If A repeats, the 
1d6 result is 2.  If B repeats, the result is 3.
A-B-B: The 1d6 result is 3.
B-A-A: The 1d6 result is 4.
B-A-B: Continue until one player repeats.  If A repeats, the 1d6 result 
is 4.  If B repeats, the 1d6 result is 5.
B-B-A: Continue until one player repeats.  If A repeats, the 1d6 result 
is 5.  If B repeats, the 1d6 result is 6.
B-B-B:  The 1d6 result is 6.

The theory behind this is that the various ranges of probability from a 
1d6 can be represented as fractions with a radix of 2, giving a lowest 
value of .0000~ (infinitely repeating zeros) .1111~ (infinitely 
repeating ones).  Generate random zeros and ones until the resulting 
fraction definitely falls into one of the ranges in question.

This is easily generalized to 1d10, 1d20, and so on.  1d4 and 1d8 are, 
of course, trivial, ending after a finite number of games.

As for generating multiple dice combinations, the simplest solution is 
to generate separate die rolls and combine them; or, you could calculate 
the different binary representations of the probability ranges for each 
possible sum, and generate the values from one stream of RPS results.

Regards,
John


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.