10
\$\begingroup\$

In a game I'm designing, usually you roll 3d10 and then keep the middle value. Example: If you roll 1, 2, and 10, your result is 2. In anydice this is easy to calculate:

output [middle 1 of 3d10]

But then, sometimes I would need to re-roll the highest or lowest of the dices (representing small advantages or disadvantages) before taking the middle one. This I have no clue how to program in anydice.

The best I came up with is something like this:

output [highest of [middle 1 of 3d10] and 1d10] named "Advantage"

output [lowest of [middle 1 of 3d10] and 1d10] named "Disadvantage"

Is this correct? It doesn't feel right. Should I use some kind of function? (which I don't know how to use, by the way).

I have no idea what I'm doing here, and I have no real skills coding or in maths. Any help would be really appreciated. I feel like this should be really simple, but I'm going insane with this.

The order of operations is:

  1. Roll 3d10
  2. Reroll lowest
  3. Keep the middle one
\$\endgroup\$
3
  • \$\begingroup\$ Maybe is worth noting than sometimes I also use rolls when you pick the lowest or highest dice of the 3. But the roll I'm asking about is to be used in other situations (is supposed to represent smaller advantages or disadvantages) Edit: Spelling (English is not my mother tonge, I apologize) \$\endgroup\$
    – Kyalur
    Sep 11, 2023 at 10:49
  • 1
    \$\begingroup\$ Isn't this the same as rolling 4d10 and keeping the 2nd highest? \$\endgroup\$
    – Qwerky
    Sep 12, 2023 at 15:56
  • \$\begingroup\$ Yes, aparently, it is. But it wasn't obvious for me until they explained that to me in the answers. \$\endgroup\$
    – Kyalur
    Sep 12, 2023 at 16:38

4 Answers 4

12
\$\begingroup\$

The default examples on anydice include the following:

output 2@4d20 named "Curved Advantage (4d20 advantage after drop[ing high & low)"
output 2@3d20 named "Curved (3d20 take mid)"

I believe this covers your regular and advantage cases, so all that's left is to add your disadvantage case, which we can do by rolling four dice and taking the third-highest value:

output 3@4d20 named "Curved Disadvantage (4d20 disadvantage after dropping high & low)"

Here's an example in action.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I'm triying to understand this, but it's very hard for me, I'm really sorry. I don't understand what the numbers before the "@" means. I'm guessing it means something like keeping the second highest value if you write "2@4d20"? Also I cannot find the default examples you mention. How and where can I find them? I must missing something obvious, probably \$\endgroup\$
    – Kyalur
    Sep 11, 2023 at 14:50
  • 1
    \$\begingroup\$ I have been searching, and I found the anydice documentation. I guess this are the examples you meant. But I'm not sure that keeping the second highest dice of 4d10 is the same as rerolling the lowest die. Maybe is it, of course. But I need to give it some thought, because, as I said, I'm not really good in maths ^^' Thank you anyways! Very useful information that I didn't knew!!! \$\endgroup\$
    – Kyalur
    Sep 11, 2023 at 15:07
  • 1
    \$\begingroup\$ Hang on, rolling four dice and taking the third highest doesn't work - if the first role is 5,4,3 and you reroll the 3 to get a 2, then you should return the 4 (second highest of the four rolls... Or have I got totally confused? \$\endgroup\$
    – Joe
    Sep 13, 2023 at 13:25
30
\$\begingroup\$

Just to complement samuei's correct answer with an explanation that wouldn't fit in a comment, taking "middle of (3d10 reroll lowest)" is actually equivalent to "second of 4d10" (in decreasing order).

To demonstrate this, consider you rolled 3 die, and label them with {A, B, C} such that A>B>C. You then reroll the lowest C (advantage), getting the new value R. Your trio becomes {A, B, R}.

Here's a table of the results (array in decreasing order) you would get with 3d10+reroll and 4d10:

Reroll result Array with 3d10+R Array with 4d10
B > R [A, B, R] [A, B, C, R] or [A, B, R, C]
A > R > B [A, R, B] [A, R, B, C]
R > A [R, A, B] [R, A, B, C]

A similar reasoning shows that "middle of (3d10 reroll highest)" is equivalent to "third of 4d10".

\$\endgroup\$
3
  • \$\begingroup\$ Okay, but if I roll 5,4,3 and then re-roll to get a 2, surely I return the 4 rather than the 3 (which I think doesn't exist now)? \$\endgroup\$
    – Joe
    Sep 13, 2023 at 13:27
  • \$\begingroup\$ @Joe I think you're mixing things up. For disadvantage, you reroll the highest value (the 5 in your example, not the 3) and then take the middle. For advantage, you reroll the lowest (the 3, which becomes 2 in your example) and then take the middle - which would be the 4 regardless \$\endgroup\$
    – No Name
    Sep 13, 2023 at 13:49
  • \$\begingroup\$ Whoops, I missed this answer and wrote basically the same thing in a comment; sorry about that! \$\endgroup\$
    – Idran
    Sep 13, 2023 at 15:16
15
\$\begingroup\$

To further complement the existing answers, you certainly can implement your "reroll lowest and take middle" mechanic literally in AnyDice, e.g. like this:

function: reroll lowest of DICE:s as REROLL:n and take middle {
  \ Start with the reroll die: \
  NEW_DICE: {REROLL}

  \ Add all of the original dice except the lowest: \
  loop POS over {1 .. (#DICE - 1)} {
    NEW_DICE: {NEW_DICE, POS @ DICE}
  }

  \ Sort the resulting new dice (from highest to lowest): \
  NEW_DICE: [sort NEW_DICE]

  \ Return the middle roll: \
  MIDDLE_POS: (1 + #NEW_DICE) / 2
  result: MIDDLE_POS @ NEW_DICE
}

output [reroll lowest of 3d10 as d10 and take middle] named "middle of (3d10 reroll lowest)"

However, if you compare the output of this program with just a straight 2@(4d10) (i.e. second highest of 4d10) roll, you can see that they're exactly identical!


Why? Well, your rolling mechanic effectively works like this:

  1. Roll 3d10.
  2. Drop the lowest roll.
  3. Add one more d10 roll.
  4. Take the middle roll.

Now, what if we reverse the order of steps 2 and 3? That is, what if we first roll 3d10 and then add one more d10 (effectively just rolling 4d10) and then drop the lowest roll before taking the middle roll (effectively just taking the second highest roll out of 4)?

Well, if the extra d10 we add in step 3 turns out to be higher than (or equal to) the original lowest roll dropped in step 2, then reversing the order makes no difference at all: we drop the same roll anyway, whether we do it before or after adding the extra roll.

On the other hand, if the extra d10 we add in step 3 ends up being lower than the original lowest roll dropped in step 2, then reversing steps 2 and 3 causes us to drop it instead of the original lowest roll. But in that case neither of the rolls was going to be selected in step 4 anyway, so it doesn't matter which one we drop!

So, either way, it doesn't matter whether we add the extra d10 or drop the lowest roll first. All that can change is the value of the lowest of the three remaining rolls, and we're not selecting that roll anyway.

(The same argument, mutatis mutandis, also shows that rerolling the highest of 3d10 and the taking the middle roll is equivalent to taking the second lowest of 4d10, i.e. 3@(4d10) in AnyDice notation.)

\$\endgroup\$
1
  • \$\begingroup\$ Thank you very much! This is very useful information! \$\endgroup\$
    – Kyalur
    Sep 12, 2023 at 8:37
2
\$\begingroup\$

I have recieved very useful answers, but I want to sumarize them so if anybody as slow as me read this, can find the answer easily.

The simple answer is use the "@" tool in anydice: If you write "output 2@4d10", anydice will take the second highest roll of the four d10.

In this case, if I want to use the "light advantage" rule I described, I would need to write "output 2@4d10". If I want to use the "light disadvantage" rule, I would need to write "output 3@4d10".

Also there are brilliant responses that explain why this is the same as roll 3, and then reroll. Check them all out.

Thank you guys for you insight! I have learned a lot!

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .