       Re: Optimization problem for dice game (repost)

• To: mathgroup at smc.vnet.net
• Subject: [mg109623] Re: Optimization problem for dice game (repost)
• From: Scott Hemphill <hemphill at hemphills.net>
• Date: Sat, 8 May 2010 07:08:33 -0400 (EDT)
• References: <hs0pod\$ds7\$1@smc.vnet.net>

```Peter Sisak <p-kun80 at hotmail.com> writes:

> Hello,
>
>   Yes, the goal is to maximize the expected score (in the calculation including the non-qualifying hands with score 0). While it is a multiplayer game, you do not see other peoples' rolls, therefore you can make no strategy adjustments based on that. For this reason, maximizing the expected value coincides with maximizing the chance of beating them, I would think.

The last statement isn't true, but we can get to that later.

What have you done so far to solve this problem?

Here's what I would do to solve it:

Define a function "score" which takes a list of the final values of the
dice and returns the score according to the criteria you mention in
point 5.

score[h_] := Total[h] /; MemberQ[x,1] && MemberQ[x,4]

score[h_] := 0

Define a function expect which takes a list of held dice plus a list of
dice just rolled and returns the expected value of the score.  Also
define a function expect which takes just a list of held dice and
returns the expected value of the score:

I use "h" for a list of "held" dice and "r" for a list of rolled
dice.

expect[h_, {}] := score[h]

expect[h_, r_] :=
maximum of the expected values achieved by adding subsets of r to h

expect[h_] :=
average of the expected values over all the possible rolls of
remaining dice

Note that "expect" is defined recursively.  The two argument version of
"expect" does a maximum over calls to the one argument version, and the
one argument version does an average over calls to the two argument
version.

You may also need a way to generate a list of the possible dice rolls:

rolls[k_] := Sort /@ Tuples[Range,k]

We can talk about optimization/collation when you have an implementation
that calculates expected values.  I don't find the table to be
excessively large.  I get

In:= N[expect[{}]]

Out= 23.46

Scott

>
> Peter
>
> ----------------------------------------
>> Date: Thu, 6 May 2010 04:50:48 -0400
>> From: hemphill at hemphills.net
>> Subject:  Re: Optimization problem for dice game (repost)
>> To: mathgroup at smc.vnet.net
>>
>> Peter Sisak writes:
>>
>>> Hello,
>>>
>>> I wish to use Mathematica to determine the best strategy applicable to t=
> he following game:
>>> 1. The game is played with 6 6-sided fair dice.
>>> 2. At the beginning of the game, the player rolls all 6 dice at once.
>>> 3. Each die may then be either a) put in hold (its value gets fixed) or =
> b) set to be re-rolled. At least one die must be put in hold per roll. If a=
> ll dice are put in hold, there are no further rolls, scoring follows.
>>> 4. On re-roll, step 3 follows again, i.e. the player decides which of th=
> e resulting dice are put in hold (at least one must be), and re-roll the re=
> st, if there are dice remaining which are not in hold.
>>> 5. Scoring is executed in the following manner: The hand must contain at=
>  least one "1" and one "4" die. If either of these cannot be found, then th=
> e hand does not qualify for scoring (the score is 0). If it qualifies, the =
> values of the respective dice are summed; the maximum reachable score is th=
> us 29 (four 6s, one 4 and one 1), while the minimum score where the hand st=
> ill qualifies for scoring is thus 9 (one 4 and five 1s).
>>>
>>> Since the dice already put in hold do not change, it is trivial that the=
>  following cases must be examined separately:
>>> a) if there are six dice that are still free, then the entire set of pos=
> sibilities.
>>> b) if there are five dice that are still free, then 1. the case when the=
>  die put in hold is a "1" 2. the case when the die put in hold is a "4" 3. =
> the case when the die put in hold is neither "1" nor "4".
>>> c) if there are less than five dice still free, then 1. the case when am=
> ongst the dice put in hold both "1" and "4" can be found 2. the case when a=
> mongst the dice put in hold "1" can be found but not "4" 3. the case when a=
> mongst the dice put in hold "4" can be found but not "1" 4. the case when a=
> mongst the dice put in hold neither "1" nor "4" can be found.
>>>
>>> It would be helpful furthermore if there would be a kind of generalisati=
> on/collation step at the final "best strategy" output, since otherwise, the=
>  number of entries in the list would be huge. Ideas?
>>
>> Although the description of the game is clear enough, what you mean by
>> "best strategy" still needs to be defined. Is the goal just to maximize
>> the expected score? If there are other players, is the goal to maximize
>> the chances of beating all of them? Do you get to see any of their
>> rolls?
>>
>> Scott
>> --
>> Scott Hemphill hemphill at alumni.caltech.edu
>> "This isn't flying. This is falling, with style." -- Buzz Lightyear
>>
> _________________________________________________________________
> Hotmail: Powerful Free email with security by Microsoft.
> https://signup.live.com/signup.aspx?id==60969
>

--
Scott Hemphill	hemphill at alumni.caltech.edu
"This isn't flying.  This is falling, with style."  -- Buzz Lightyear

```

• Prev by Date: Re: matrix equation
• Next by Date: Mathematica in Education and Research?
• Previous by thread: Re: Optimization problem for dice game (repost)
• Next by thread: Re: Optimization problem for dice game (repost)