> >  - there are n integers in the sequence
> >  - the sum of the integers in the sequence is x
> >  - the value of each integer in the sequence is between 1 and
> 6, inclusive
> >
>
>     There are a couple of things that I'm not following.
>
> 1. Does the board have a static number of spaces?
> 2. Are there a set number of turns, or can it take as long as it takes?

I get the impression it is a set number of turns. In that case, you'll need
to be a bit canny, doing something like biasing the roll according to the
distance to the goal. In pseudocode:

To move S squares in N turns
Divide S by N to get the average number needed: call it m
Find the minimum value needed: min q>=1 such that (S-q)/(n-1)<=6
Fing the maximum value needed: max r<=6 such that (S-r)/(n-1)>=1
(If you can't find any such q or r then the problem can't be solved)
Now you need to find a number between q and r with expected value m. If r-q
= Z then we're looking for a set of probabilities p[i] such that:
Sum(i=0 to Z) {q+i)*p[i]} = m, with 0<=p[i]<=1 and sum(p[i]) = 1

This evaluates to q + mean(p[i]) = m, so any distribution of Z+1
probabilities with a mean of m-q will work. For example you could use a
binomial distribution p[i] = C(Z,i)p^i*(1-p)^i, where p = (m-q)/Z - however
this would probably be a bit too noticeable as you'd get very few 1's or
6's. To reduce this skew, you could make a weighted average of a uniform
distribution and a binomial distribution. Back-of-the-envelope calculations
suggest:

p[i] = t/(Z+1) + (1-t) C(Z,i)p^i*(1-p)^i

Here, t is a parameter that describes the weighting, set by you (you could
start with t = 1, a completely uniform distribution, then gradually reduce
it to make the rolls more deterministic towards the end; or you could change
t depending on how far m is from the unbiased value of 3.5). For a given t,
you can determine p so as to get the correct mean m - I think this amounts
to:

p = (m - tZ/2) / ((1-t)*Z)

There are plenty of other distributions you could use instead.

Nice problem!

Danny

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to