My question is about probabilities. Given are two sets of regular, 6-sided, fair dice of at least one die (but no upper bound on the number of dice). Now, 1 of the sets is considered to be 'the winner'. This is determined with the following method:
Sort both sets on the number of eyes. Compare the dice of both sets 1-by-1 starting at the highest by pairing up the dice from both sets (compare 1st with 1st, 2nd with 2nd etc.). As soon as 1 die is higher than the other, then the respective set is the winner and the other dice are ignored. If both sets have an equal number of dice and all dice are equal, then it's a tie. If it's a tie except that one set still has dice left (is a bigger set), then that set is the winner.
Examples:
A: 6 5 5 (winner)
B: 6 5 4
A: 4 (winner)
B: 1 1 1
A: 6 5 2 2
B: 6 5 2 2
(tie)
A: 6 5 1 (winner)
B: 6 5
Question: How can I calculate the probability that a certain set wins after you throw all dice, given only the sizes of both sets?
Edit: The answer can either be a function with 2 inputs, or if this is not possible, an algorithm that calculates this. In practice, the number of dice will be very small (usually smaller than 5).
Edit 2:
Context: These are the rules for resolving a speed roll to determine initiative in a fight between gladiators in the board game called Spartacus. I'm programming a hobby project where I'm simulating such fights and I want to use the probability of either gladiator winning initiative. The probability is used in a Minimax algorithm to generate child positions of the starting position.
Disclaimer: I'm not a mathematician and I have little mathematical knowledge but I do know algebra etc. I'm looking for an answer in the form of an equation with 2 unknowns: sizes of both sets or an algoritm that accepts those inputs

Getting an exact answer is going to be immensely difficult; in lieu of that, here's a very rough first-order approximation. I'm going to make one simplification: rather than a 6-sided die, I'm going to let the number of sides on the die 'go to infinity': player A picks $a$ real numbers uniformly between 0 and 1, while player B picks $b$ real numbers, and A wins if their largest number is greater than B's largest. The continuous nature of this version of the problem means that ties are 'impossible' (0 probability), so we don't have to worry about tiebreakers; we can just look at the largest value for each player.
Now, the cumulative distribution function of the minimum of $n$ real numbers chosen uniformly from [0,1] is well-known: it's just $F(x)=x^n$.
So how do we express the probability that a random sample from the distribution with CDF $F_A(x)$ is greater than a random sample from the distribution with CDF $F_B(x)$? Well, a 'measure' on A's distribution is $dF_A(x) = F'_A(x)dx$; and given any point $t$ in [0,1], the probability that a sample from B's distribution is less than t is $F_B(t)$ by definition! So the probability that a sample from A is greater than than a sample from B is $\int_{t=0}^1F_B(t)F'_A(t)dt$. Integration by parts tells us that the probability that a sample from B is greater than a sample from A is exactly 1 minus this: $\int_{t=0}^1F_A(t)dF_B(t) = \left[F_A(x)F_B(x)\right]\big|_{x=0}^1 - \int_{t=0}^1F_B(t)dF_A(t)$, and the quantity in braces is $F_A(1)F_B(1)-F_A(0)F_B(0) = 1-0 = 1$.
Now, if $A$ has $a$ dice and $B$ has $b$ dice, then $F_A(x)=x^a$ and $F_B(x)=x^b$, so $F'_A(x) = ax^{a-1}$. For the integral we have $\int_{t=0}^1t^bat^{a-1}dt$ $= \int_{t=0}^1at^{a+b-1}dt$ $= \left(a\dfrac{t^{a+b}}{a+b}\right)\big|_{t=0}^1$ $=\dfrac{a}{a+b}$; in other words, A's winning chance is exactly equal to the proportion of the 'dice' that they have. This should provide a reasonable first approximation to the probability you need. Note that this won't be exact even in the cases where A and B can't tie: for instance, if A has four dice and B has three then A's winning probability must be some multiple of $\frac1{6^7}$ since that's the size of the probability space, but this approximation gives A's chances at $\frac47$, which can't be of that form since $7$ doesn't divide $6^7$.
ETA: as Erick Wong notes in a comment below, this approximation gets much worse in the regime where the number of dice is large compared to the number of values they can take on, since discrete effects come into play more strongly there (both A and B are likely to have rolled multiple sixes if A rolls 150 dice and B rolls 100, for instance, and A is much more likely to have rolled more than B than this estimate would suggest). Some quick numerical simulations suggest that the estimate is okay(ish) in the realm where a and b are comparable to the number of sides; for instance, it gives $\frac47\approx 0.57\ldots$ for the chance of A winning a 4:3 roll, whereas the actual probability seems to be slightly less than $0.61$. OTOH, for something like a 9:2 roll it gives A's probability as $\frac9{11}\approx 0.82\ldots$, whereas the actual probability seems closer to $0.92$