# How can I write and compare these formulas using Anydice?

I'm attempting to use AnyDice to detect any differences in how we have started to value AC in our D&D game.

We used to roll 1d20+mods Vs Target Armor Class
For example, lets use this: 1d20+8 Vs 16 AC.

I want to compare the to-hit chance using the traditional method (above) against a new formula (below).

1d20+mods+10-1d20 - We are now using 10-1d20 to get a random AC value.

So basically, I want to have the results in AnyDice so I can compare / show them to our other players.

Clarification ----
I managed to clarify with my DM how he is running things. Basically we would want to compare something like this:
output 1d20+8 > X named "Old Way"
output 1d20+8 > X+1d20 named "New Way"

So in the above example, X represents a base AC. In the Old Way, that would be, lets say 16 and in the new way that would be -10, so 6. I can run that against a static number but it would be great to run it against the following sample values:
Old Way AC values: 13, 14, 15, 16, 17, 18, 19
New Way AC values: 3, 4, 5, 6, 7, 8, 9 (+1d20)

• I think I misunderstand. Is the base AC 10-1d20 or is that the actual AC (ignoring things like +dex with light armor, etc.). – David Coffron Mar 14 '18 at 22:52
• Related, possibly duplicate: rpg.stackexchange.com/q/101166/36151 – nwp Mar 15 '18 at 0:01
• I'm voting to put this question on hold until OP helps us understand what these formulae are and what they are supposed to mean. Until then there really isn't a way to answer this. – Rubiksmoose Mar 15 '18 at 0:45
• Ok. So managed to clarify with my DM how he is running things. Basically we would want to compare something like this: output 1d20+8>X named "Old Way" output 1d20+8>X+1d20 named "New Way" So in the above example, X represents a base AC. In the Old Way, that would be, lets say 16 and in the new way that would be -10, so 6. I can run that against a static number but it would be great to run it against the following: Old way AC values: 13, 14, 15, 16, 17, 18, 19 New way AC values: 3, 4, 5, 6, 7, 8, 9 (+1d20) – Moonie Mar 15 '18 at 10:46
• So the new way is replacing 10 “points” do AC with a d20 roll? – Christopher Mar 15 '18 at 10:59

Making the assumption that a 1 on the attack roll is still an automatic miss and a 20 on the attack roll is still a critical hit (regardless of the roll for the defender's AC), this program will show you a comparison between the old and the new way of doing things:

function: attack D:n plus ATK:n vs AC:n {
if D=20 {result: 1}
if D=1 {result: 0}
result: D+ATK>=AC
}

loop MOD over {0..0} {
loop AC over {10..19} {
output [attack 1d20 plus MOD vs AC] named "Classic +[MOD] vs. AC[AC]"
NEWAC: AC - 10
output [attack 1d20 plus MOD vs 1d20+NEWAC] named "New +[MOD] vs. AC[NEWAC]"
}
}


First, we declare a function to simulate attack rolls, since we need to handle the special case for critical hits/misses. If the roll is not 1 or 20, it just tells us if the attack roll meets or beats the AC.

Then we use loops to iterate over a selection of values for comparison. In the default case in my program, it only tests attacks with a +0 modifier, but against ACs ranging from 10 to 19 (converting to 0-9 in the alternative system). It should be obvious how you can alter these ranges if you want to investigate other numbers.

The ultimate effect of introducing this additional randomness is to slightly skew the hit:miss chance towards 50:50, increasing the uncertainty of the result. If a hit was unlikely before due to low bonus against a high AC it becomes more likely, but if a hit was very likely due to a high attack bonus relative to AC, it becomes less likely to hit. The difference is not large, so it doesn't seem like it would make a significant difference to the balance of the game. However, as a general rule, increased randomness hurts the players more than the NPCs they fight - players are usually most likely to win, so more randomness skews the distribution and reduces their odds of success.

I don't know what you want but it is what you asked for:

output 1d20+8>=16

output 1d20+8+10-1d20>=0


http://anydice.com/program/f1dd

They are no where near equivalent: the first has a 35% chance of a hit, the second a 99.25% chance.

• I think you read that wrong and the second actually has a 99.75% chance to hit. But the point of non-equivalence still stands. – nwp Mar 14 '18 at 23:36
• I think it should be (1d20 + 8 - 10 + 1d20)>=0 if that interpretation of his question is correct since it is versus the new AC formula but I'm not sure how he is calculating AC exactly. – David Coffron Mar 14 '18 at 23:46
• 1d20+8>=16+1d20-11 would make sense to me. It's basically the old formula with the extra term +1d20-11 which should have little impact. – nwp Mar 15 '18 at 0:00
• @nwp probably, but it’s not for us to guess - if the OP clarifies I’ll change the answer. – Dale M Mar 15 '18 at 0:34