7
\$\begingroup\$

I'm curious about this dice mechanic and am interested in visualizing the value ranges and their associated probabilities, but I'm having difficulty wrapping my head around how exactly to input it into Anydice. The mechanic is as follows: Given a pool of dice rolled and summed, add 1 to the total for each die that rolled below the highest result.

So for example, 4d4 (1, 2, 3, 4) would be 13, while 4d4 (4, 4, 4, 4) would be 16. 4d4 (1, 1, 2, 2) would be 8.

This question seems to be doing something similar, so it intuitively feels like it could be a simple modification to the top answer there? But again, I don't really know what I'm doing.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ @matszwecja it's slightly different. The 1 is only added to those that roll lower than the highest result on that set of 4 rolls, and not about lower than 4. That's why the 1,1,2,2 example the result is 8, as it's converted into 2,2,2,2, not 2,2,3,3 \$\endgroup\$ Commented Feb 19 at 11:57
  • \$\begingroup\$ @justhalf Fair enough, deleted \$\endgroup\$ Commented Feb 19 at 12:04

3 Answers 3

7
\$\begingroup\$

It’s a bit janky

function: plus A:s { R: {} loop N over {1..#A} { if N@A=1@A { R: {R, N@A} } else { R: {R, N@A+1} } } result: R } output [plus 4d4] 
\$\endgroup\$
13
\$\begingroup\$

Here's a one-line function that does the same thing as Dale M's answer:

function: plus A:s { result: A + (A < 1@A) } output [plus 4d4] 

On one hand, this is shorter; on the other hand, it requires understanding AnyDice's implicit conversion rules for sequences:

  • First, A < 1@A has a sequence on one side and a number on the other. In this case, AnyDice compares the number to each element in the sequence. The value of the expression is the number of elements for which the comparison evaluated true. So this counts the number of dice that rolled less than the highest die.
  • Then, we have A plus the result of the previous step. For addition between a sequence and a number, AnyDice first sums all the elements in the sequence (here, the raw sum of the pool), then adds the number (here, the number of dice that rolled less than the highest die).

Note that A + A < 1@A or A < 1@A + A would not give the correct answer, as the + operator has a higher precedence than the < operator. Thus, without the parentheses, the addition would be evaluated first.

\$\endgroup\$
8
\$\begingroup\$

That's a bizarre statistic...

let's see what all is a 16: (4,4,4,4) (4,4,4,3) (4,4,3,3) (4,3,3,3) all are a 16 under that method. Similarly, the whole table shifts:

Value Main Combo Subcombo 1 Subcombo 2 Subcombo 3 Subcombo 4 Subcombo 5 Subcombo 6
16 4-4-4-4 4-4-4-3 4-4-3-3 4-3-3-3
15 4-4-4-2 4-4-3-2 4-3-3-2
14 4-4-4-1 4-4-3-1 4-3-3-1 4-3-2-2 4-4-2-2
13 4-4-2-1 4-3-2-1 4-2-2-2
12 4-4-1-1 4-2-2-1 4-3-1-1 3-3-3-3 3-3-3-2 3-3-2-2 3-2-2-2
11 4-2-1-1 3-3-3-1 3-3-2-1 3-2-2-1
10 4-1-1-1 3-3-1-1 3-2-1-1
09 3-1-1-1
08 2-2-2-2 2-2-2-1 2-2-1-1 2-1-1-1
07
06
05
04 1-1-1-1

You easily see, that there are 30 different outcomes, with only 10 different values. Now, we need to get to the percentages:

  • 4 times the same number is \$1/4^4=1/256=0.0039\$ or roughly 0.4%.
  • 3 times the same number, once one less is \$4/256\$
  • 2 times the same, twice one less is \$6/256\$
  • 1 times the high, three times the one less is \$4/256\$

As a result, 16 has a chance of \$15/256\$. Repeat the math for the other values... ...and so on and so on. It's a lot of math, where you sum up how many variants there exist for each combo or subcombo and multiply with 1/256, then sum for each line... I am not fully confident I did the math here correctly, but the orders of magnitude should be somewhere around these:

Value Chance
16 15/256
15 28/256
14 46/256
13 40/256
12 45/256
11 40/256
10 22/256
09 4/256
08 15/256
04 1/256
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Your probabilities sum to 226/256, so something is off. I think you're missing 14) 4-4-2-2: 6/256, 14) 4-3-2-2: 12/256, 12) 4-3-1-1: 12/256 \$\endgroup\$ Commented Feb 18 at 14:38
  • 3
    \$\begingroup\$ @Dave Thanks! doing it manually is so fucking hard, that you overlook stuff - which is why I noted that I might be off \$\endgroup\$ Commented Feb 18 at 17:30

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.