Well, let's write your function for you:
function: compare highest N:n of ROLL:s and SEQ:s {
loop I over {1..N} {
if I@ROLL != I@SEQ { result: 0 }
}
result: 1
}
This function just compares the first N
elements of the sequences ROLL
and SEQ
one by one. (If the sequences are sorted in descending numerical order, like AnyDice sorts dice rolls by default, those will be the N
highest elements.) If any of them are different, it stops and returns 0; if they all match, it returns 1.
When a dice pool is passed as one (or even both) of the parameters to this function, AnyDice automatically calls the function for each of the possible sequences of dice produced by the roll(s) and collects the results into a biased die representing the probability of the function returning each of its possible result values.
The key thing to realize here is that, when passing a dice pool into a function expecting a sequence like this, AnyDice doesn't really provide any practical way to get the individual sequences of rolled dice out of the function. All we can get out is a single biased die. This means that, whatever manipulation we want to do with the sequences themselves, we'll have to do inside the function.
Ps. Alternatively, I could've used the highest NUMBER of sequence SEQUENCE
function from this answer, and rewritten the function above simply as:
function: compare highest N:n of ROLL:s and SEQ:s {
result: [highest N of sequence ROLL] = [highest N of sequence SEQ]
}
But, besides requiring another custom function as a helper, this version is also probably somewhat less efficient, since it has to loop over both input sequences to make partial copies of them. The first version above does the same thing with just a single loop and no sequence copying.