so it goes

Following my last post it occurred to me that not everyone would run the code posted in this blog. So I thought it might be helpful to tabulate the probabilities of scatter by area of effect size, so that people could see the effects of scatter at a glance. I was so surprised by the result that I had to create the corresponding plot before I believed it.

Here is the code to determine the probability of a hit following a miss roll. Note that only the distance roll is important when the template starts directly over a round base.

> diams <- c(30, 40, 50)
> aoes <- c(3, 4, 5)
> probs <- matrix(NA, nrow = 3, ncol = 3, dimnames = list(diams, aoes))
> combs <- expand.grid(dist = 1:6, dir = 1:6)
> out <- vector(mode = "logical", length = nrow(combs))
> for (k in seq_along(aoes)) {
+     for (j in seq_along(diams)) {
+         for (i in seq_along(out)) {
+             out[i] <- is.scatter.hit(list(stats = c(AOE = aoes[k])),
+                 short = 0, base = diams[j], dice = unlist(combs[i, ])) }
+         probs[j, k] <- sum(out) / length(out)
+ }}
>
> round(probs, 3)
       3     4     5
30 0.333 0.333 0.500
40 0.333 0.333 0.500
50 0.333 0.333 0.500

But this is odd I hear you cry! Two nested loops? I know, it’s not ideal, but it does what I wanted it to do! But look, the base size does not have an influence on the probability of a scattering shot (which is in range) remaining over the target. Three and four inch diameter area of effects cause blast damage on a 1 or 2 on the distance roll for any size base.  Five inch diameter area of effects cause blast damage on a 1, 2 or 3. I thought I might have made a mistake, so here’s the plot.

> plot(c(-5, 5), c(-5, 5), type = "n", axes = FALSE, xlab = "", ylab = "")
> # add lines
> matlines(matrix(x3, ncol = 3),
+     matrix(y3, ncol = 3),
+     lty = 2, col = 1)
> text(x3 * 1.1, y3 * 1.1, labels = c(6, 3, 1, 4, 2, 5), col = "grey")
> x <- cos(pi/6)
> y <- sin(pi/6)
> symbols(c(x, 2 * x, 3 * x,
+         0, 0, 0,
+         -x, -2 * x, -3 * x,
+         0, 0, 0),
+     c(y, 2 * y, 3 * y,
+         -1, -2, -3,
+         y, 2 * y, 3 * y,
+         0, 0, 0),
+     circles = c(rep(aoes / 2, each = 3), 0.5 * diams / 25.4), 
+     add = TRUE, inches = FALSE,
+     bg = c(rep(c("#2222EE44", "#2222EE44", "#EE222244"), times = 2),
+         c("#22EE2244", "#22EE2244", "#22EE2244"),
+         rep("#FFFFFF22", times = 3)))

Image

This plot is kind of hard to read, but pretty. Each outer circle is a 3, 4 or 5 inch diameter area of effect which has scattered 1, 2 or 3 inches. The three inner circles are 30, 40 or 50 mm bases. All three 5 inch area of effects (green) catch all three bases. Only the first two 3 and 4 inch area of effects (blue) catch all three bases. So next time a 4 inch area of effect drifts, be careful, it only catches large bases on a 1 or 2! A three misses by a whisker (red).

Here is the probability of blast table, including huge bases for completeness.

> diams <- c(30, 40, 50, 120)
> aoes <- c(3, 4, 5)
> probs <- matrix(NA, nrow = 4, ncol = 3, 
+     dimnames = list(diams, aoes))
> combs <- expand.grid(dist = 1:6, dir = 1:6)
> out <- vector(mode = "logical", length = nrow(combs))
> for (k in seq_along(aoes)) {
+     for (j in seq_along(diams)) {
+         for (i in seq_along(out)) {
+             out[i] <- is.scatter.hit(list(stats = c(AOE = aoes[k])),
+                 short = 0, base = diams[j], dice = unlist(combs[i, ])) }
+         probs[j, k] <- sum(out) / length(out)
+ }}
>
> round(probs, 3)
        3     4     5
30  0.333 0.333 0.500
40  0.333 0.333 0.500
50  0.333 0.333 0.500
120 0.500 0.667 0.667
Advertisements

2 thoughts on “so it goes

  1. Pingback: keep a low profile | analytical gaming

  2. Pingback: rules of engagement | analytical gaming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s