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 3791 times)

Rooster

  • Bay Watcher
  • For Chaos!!!
    • View Profile
A Math Challenge
« on: August 14, 2010, 05:56:06 am »

I have a question for you that I'm to stupid to answer:

We have a set of dice: d2,d4,d6,d8,d10,d12,d20

How would you approach the problem of generating a range of any numbers from any die?

For exaple, if I want to generate a number from 1 to 2 I would roll d10 two times to roll for percentage. 1-50 would be a 1, and 51-100 would be 2.

So how would you roll a d20 only having d6's ?

How do you roll any dice with any other?

Hint: If I roll two d6, the probablity of getting a 12 would be the lowest, but getting a score of 6 would be highest.

So... how do I approach this problem?
Logged

Nintenlord

  • Bay Watcher
  • Adamantine fever
    • View Profile
Re: A Math Challenge
« Reply #1 on: August 14, 2010, 06:49:21 am »

Well, one way would be to find the smallest common multiple aka least common multiple of the bases of dices, then throw the dice you have LCM/(base of the dice you have) times, take the string of values, such as (with traditional base 6 dice) 045241 (subtract 1 from every value, since ordinary dice goes from 1-6 instead of 0-5) and convert it the base of the dice you need and then just pick the lowest digit as the result (again, if the dice you need doesn't have 0, add 1 to the value). Should be fair (I'm only 90% certain), but it's quite a lot of work for a non-mathematician. Online base converter will make the job easier and so will online LCM calculator as well, though.
Logged
The only dragon I've seen in game walked into my rats nest of a fortress and died in the flames of the conflagration he started in the dining hall.  Of course, nearly every dwarf was dead by then, but we consider it a tactical victory.

ed boy

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #2 on: August 14, 2010, 07:02:03 am »

Here's a solution (there may be more, but this is the first that sprang to mind).

Let's imagine that you have a dice of X sides, and you want to generate an integer.

The first step is to find the number of potential results that you want to be potentially generated. If they are in a simple range (i.e. 5 to 25) it is a simple matter, but with more complex sets you might have to add them up individually. Let us call the number of potential results Y.

Now what you want to do is find any value of Z where XZ is greater than or equal to Y. The lower the number, the better, but having it higher than neccessary will still produce a valid random result. If you are familiar with logarithms, then round up logXY (rounding up if there it is not an integer is very important. If your calculator cannot do log of base X, then do lnY/lnX).

What you do now is roll your dice Z times. If we call the first number that comes up A,the second B, and so on, you will want to add the results up as such:
R=A+BX+CX2+DX3....
if R is greater than Y, start rolling your dice again until R is less than or equal to Y.
You can then get your number. Put the potential results in any order (asceding order, for example), and select the Rth result from that list.

It works because:
When you generate R, you are generating one of XZ numbers. Since each of these numbers has only once combination of dice results that generates it, they all have an equal chance. Each result in Y corresponds to a result in XZ. If you generate a result in the range XZ that does not correspond to a result in Y, you keep trying again until you do.

You can generate an infinite series to give the probability (P) of any given result being returned:
(1/XZ)+(1-Y/XZ)(1/XZ)+(1-Y/XZ)2(1/XZ)...

This is an infinite series of intial value 1/XZ and ratio (1-Y/XZ). Since XZ is greater than or equal to Y, the ratio is between 0 and 1. We can therefore say that it comes to a finite sum of (after a bit of cancelling out) 1/Y.
« Last Edit: August 14, 2010, 07:17:06 am by ed boy »
Logged

Evergod41

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #3 on: August 14, 2010, 07:22:31 am »

Completely off topic and completely un-needed, but, I happen to own a pair of d20 and d12 dice, it's pretty awesome.

ed boy

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #4 on: August 14, 2010, 07:32:14 am »

Fun fact: A true dice will only ever come in multiples of four and six.
Logged

Rooster

  • Bay Watcher
  • For Chaos!!!
    • View Profile
Re: A Math Challenge
« Reply #5 on: August 14, 2010, 10:28:03 am »

I think I'll be trying to use this method to generate dice results.
It should be awesome... and tedious... and take a lot of time, but lo! It will be glorious.

Evergod41: Do people even use d12?

ed boy: Maybe because it's physically impossible to make a dice of different number od sides :P
Logged

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: A Math Challenge
« Reply #6 on: August 14, 2010, 10:49:26 am »

Evergod41: Do people even use d12?
Quite a few pen and paper games use them, games like d&d and whatnot.
Logged

Astramancer

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #7 on: August 14, 2010, 12:20:07 pm »

Fun fact: A true dice will only ever come in multiples of four and six.

WRONG!

Five-Sided

Seven-Sided

I owned a five-sided and a 7-sided.  I generated 10,000 results and it was statistically accurate to a reasonable degree (~4% variance).  (My old job involved an awful lot of sitting around and doing nothing).
Logged

ed boy

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #8 on: August 14, 2010, 12:47:07 pm »

Impressive, but not all the faces have values, nor are all the faces the same - though it appears as if the centre of gravity will not allow it to remain in such a position.
Logged

Astramancer

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #9 on: August 14, 2010, 01:29:48 pm »

The five-sided actually has 20 facets, but like you said, it can't rest on any but the 5 numbered ones (except on uneven surfaces, of course).

The seven-sided does only have 7 sides though, it's a pentagonal prism - five rectangular faces and 2 pentagonal faces.  You would think that the fact that the 1 and 7 have a much larger surface area would affect things, but it doesn't.
Logged

Frelock

  • Bay Watcher
  • Dabbling Philosopher
    • View Profile
Re: A Math Challenge
« Reply #10 on: August 15, 2010, 01:28:28 am »

The mathematician in me would like to point out that you can't get any number as there are an uncountable number of irrationals, therefore no function from a countable set (like the integers) will be onto.  In layman's terms, you can't get pi from dice.

For the normal function, take a dice with an even number of sides.  A "high" number (higher than the average) goes to 1, a "low" number goes to 0.  Create a binary string in this manner with as many digits as is necessary so you exceed your desired count.  If the number rolled falls outside the count, re-roll.

Example: I want to roll a d10 using only a d6.  As 1111=15, 4 rolls will be sufficient.  I roll a 6,4,5,2,4, which translates to 1101, which is 13.  This is outside my range of probabilities, so I re-roll.  This time I get 2,5,3,6,1, which translates to 01010, which is 6, so my final answer is 6.  Though the probability of a re-roll is higher than the probability of getting any individual number, the probabilities of all the numbers are the same, which is what matters.

It's basically ed boy's system, only simplified down to base 2 so you don't have to worry about changing bases too often or anything like that.

If you have a d10, you're in luck, as there's no need for a base change.  Just roll and let that be your digit.  Of course, you'll wind up with a lot of re-rolls as powers of ten get really big really quickly, but it's a viable system.
Logged
All generalizations are false....including this one.

Vector

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #11 on: August 15, 2010, 01:31:57 am »

^

Brilliant.
Logged
"The question of the usefulness of poetry arises only in periods of its decline, while in periods of its flowering, no one doubts its total uselessness." - Boris Pasternak

nonbinary/genderfluid/genderqueer renegade mathematician and mafia subforum limpet. please avoid quoting me.

pronouns: prefer neutral ones, others are fine. height: 5'3".

Muz

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #12 on: August 15, 2010, 05:41:30 am »

I owned a five-sided and a 7-sided.  I generated 10,000 results and it was statistically accurate to a reasonable degree (~4% variance).  (My old job involved an awful lot of sitting around and doing nothing).

Lol, I hope you documented those results. You should roll every kind of dice a few million times and see if it'd win you an Ig Nobel prize :P
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Gorjo MacGrymm

  • Bay Watcher
    • View Profile
Re: A Math Challenge
« Reply #13 on: August 15, 2010, 10:18:58 am »

Logged
"You should stop cutting down all these herr trees, or, MAN is my Queen going to be Aaaaa-aang-Re-ee with you guys!" flipping his hand and batting his eyelashes."
"Oh my god guys, wood, is like, totally murder."

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: A Math Challenge
« Reply #14 on: August 15, 2010, 10:40:11 am »

^

Brilliant.
Just to make it clear: Vector is some kind of math genius, so if she says something is brilliant it REALLY IS brilliant.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...
Pages: [1] 2 3 4