 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Assigning a wonky die (Posted on 2006-04-28) I have an unfair die whose sides are known to have the following probabilities:{.02,.04,.08,.12,.24,.5}
Assign the numbers {1,2,3,4,5,6} to these sides so the expected roll is the same as for a fair die.

Can you solve this without brute force?

 See The Solution Submitted by Jer Rating: 3.0000 (1 votes) Comments: ( Back to comment list | You must be logged in to post comments.) More brute force | Comment 3 of 4 | If the weights are in sequence
.02  .04  .08  .12  .24  .5

the numbers can be assigned in any of these orders:

134562
165324
246153
251643
325614
452163
526134
531624
612453
643215

or, looked at the other way around, for faces 1, 2, 3, 4, 5, 6:

` 0.02 0.50 0.04 0.08 0.12 0.24 0.02 0.24 0.12 0.50 0.08 0.04 0.12 0.02 0.50 0.04 0.24 0.08 0.08 0.02 0.50 0.24 0.04 0.12 0.24 0.04 0.02 0.50 0.08 0.12 0.12 0.08 0.50 0.02 0.04 0.24 0.12 0.04 0.24 0.50 0.02 0.08 0.08 0.24 0.04 0.50 0.02 0.12 0.04 0.08 0.50 0.12 0.24 0.02 0.24 0.12 0.08 0.04 0.50 0.02`

the first list from:

DECLARE SUB permute (a\$)
CLS
DATA .02,.04,.08,.12,.24,.5
FOR i = 1 TO 6
PRINT vl(i);
NEXT
PRINT

a\$ = "123456": h\$ = a\$
DO
t = 0
FOR i = 1 TO 6
t = t + vl(i) * VAL(MID\$(a\$, i, 1))
NEXT
IF t = 3.5 THEN
PRINT a\$
ct = ct + 1
END IF
permute a\$
LOOP UNTIL a\$ = h\$
PRINT ct

and the latter list from

DECLARE SUB permute (a\$)
CLS
DATA .02,.04,.08,.12,.24,.5
FOR i = 1 TO 6
PRINT vl(i);
NEXT
PRINT

a\$ = "123456": h\$ = a\$
DO
t = 0
FOR i = 1 TO 6
t = t + vl(i) * VAL(MID\$(a\$, i, 1))
NEXT
IF t = 3.5 THEN
FOR i = 1 TO 6
ix = INSTR(a\$, LTRIM\$(STR\$(i)))
PRINT USING " #.##"; vl(ix);
NEXT
PRINT
ct = ct + 1
END IF
permute a\$
LOOP UNTIL a\$ = h\$
PRINT ct

 Posted by Charlie on 2006-04-28 15:01:51 Please log in:

 Search: Search body:
Forums (4)