I'm trying to check the probabilities of rolling 2d20, and dropping the farthest from ten using anydice. (i.e. "Most Average" weighted roll, similar to 5e advantage/disadvantage. Basically you'd always roll 2, and drop one based on adv/std/dis.) I'm having trouble with the syntax. I can lay out the nested if/then statements, I think but it's not working out, and I don't really understand it from the documentation.
Because I want to maintain the 5% ish criticals, I need to reconsider them, and I think they'll still work with Adv/Dis rolls. So I opted for pairs and 'opposites' between the two dice. (But not exactly, I'd use 21's but 20's are easier to calculate at a glance.)
For totals of 20 (19 + 1, etc.) it counts as a critical success. For pairs, (A = B) it counts as a critical failure. For double 20's it's a double critical. For double 1's it's a double fail. For double 10's it's a critical s/f. (Auto crit, not an auto S/F like the others, I just want it to tell me when it happens.) Otherwise, it will output the die closest to 10 and drop the other.
Can I get some help writing this out?