AnyDice: How to compare highest roll of two dices with another result

anydice

My question is that I want a system where I am always rolling 2 dices (let's say 1d4 & 1d8) to get the highest result of these two. Then, roll the difficulty with another dice (let's say 1d6) and compare these results to see what are the odds of a failure, a tie, and a success for different difficult dices.

I don't know how to make it on AnyDice to have precise numbers. Can someone help me?

Best Answer

Part 1: highest of A and B for skill dice

output [highest of 1d4 and 1d8]

You can even chain that, which you can see in action here

Part 2: >1d6 for comparison to difficulty dice

output [highest of 1d4 and 1d8]>1d6

This compares the highest of the two dice with the 1d6, and if it's higher, it's a 1, otherwise a 0.

The end result using > = < is this:

61.46 % higher, 12.50 % Tie, 26.04 % smaller for a difficulty die of 1d6.

Adaption is simple!

To adapt, just alter the dice in the upper portion of this Script:

SKILL_A: 1d4
SKILL_B: 1d8
DIFF: 1d6

output [highest of SKILL_A and SKILL_B]>DIFF named "Higher"
output [highest of SKILL_A and SKILL_B]=DIFF named "Equal"
output [highest of SKILL_A and SKILL_B]<DIFF named "Lower"

Streamling with functions

Anydice allows running functions. And Ilmari Karonen did a very quick streamline on it, that allows working from it later.

Larger, equal, and smaller than can be seen as "[this] - [that]" and then seeing a positive, 0 or negative value. So just to see 1, 0 and -1, you can truncate it with:

function: sign of N:n {
  if N < 0 { result: -1 }
  if N > 0 { result: 1 }
  result: 0
}

The operative line then becomes

output [sign of [highest of SKILL_A and SKILL_B] - DIFF] named "1 = higher, 0 = equal, -1 = lower"

Resulting in this script