Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4]

Author Topic: A Math Challenge  (Read 3765 times)

keda

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #45 on: August 28, 2010, 02:08:54 pm »

If say you want to use a d6 to simulate a d5, you don't want to throw 5 times, then do integer division by 6. To minimize the avg throws, you throw and use the number you get and rethrow at 6.
5/6 of the time, you only throw once. 5/36 two, 5/6^n n.
A d10 can be thrown once and divide by 2. A d9 is the worst case scenario, since 4/9 of the time is a rethrow. But no matter, the avg number of throws is still less than 2.


5/9 one
5*4/81 two (1.05 cumulatively)
5*4*4/729 three (1.38 cumulatively)
5*4^(n-1)/9^n
...
seems to converge toward 1.80
My intuition tells me that it will always be less than 2 no matter how many sides the die has, as long as it has more sides than the one you want to simulate (if it has less say x, then just throw n times to simulate x^n sides).

Anyways, I think one can minimize the number of avg throws further, especially for these worst case scenario throws, by recycling the restering numbers, and these are more the "worse" the case was. Lets say you throw a 8 with a d9. Then the rest is 8 modulo 5 = 3 (if you want to simulate d5). For the next throw, you have a simulated 36 sided die, because you have 4 different recycled numbers to combine with the 9 sides of the new outcome. Divide the result by 7, and you will not have to throw again 35/36 of the time. But maybe that's too much of a bother to calculate and you just throw until you get a valid number.

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: A Math Challenge
« Reply #46 on: August 29, 2010, 07:02:28 pm »

The ultimate test of any solution:

Can it simulate a 221-sided die from exclusively 6 sided dice? 4 sided? 20 sided? 41 sided?
Logged
Eh?
Eh!

ed boy

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #47 on: August 29, 2010, 08:36:57 pm »

Yes. Most, if not all of the methods posted here can.
Logged
Pages: 1 2 3 [4]