3
\$\begingroup\$

Trying to run some statistics on anydice and I'm getting an odd result. Figure something must be wrong with my code but I can't find it.

My situation is this: Player rolls 4d6 and drops lowest. They look at the remaining 3. They count successes (for this example, a success is a 6 or higher only). If they get at least 2 successes, the overall roll is a success.

I want to allow the player to gain "points" to increase the value on one or more dice by 1 based on game factors. So if they have 2 points and they roll a 4, 5, 6, the 6 is already a success, they can increase the 5 to a success using one of their 2 points, and the 4 would only be able to increase to a 5, so they can't spend their second point.

My problem is that regardless of die size or whether I do a "roll 3d6" or "roll 4d6 drop lowest" or if I change how much a "point" lets you adjust a die by or even if I change the success threshhold, I'm finding no difference in probabilities between giving the player 2 points or 3 points. Given none of those variables make a difference, I figure something must be wrong with my code block, rather than it just being some vanishingly small probability thing.

Here's my code:

T: 6   \ minimum success\

function: successes in ROLL:s with POINTS:n points {
  SUCCESSES: 0
  REMAINING: POINTS
  if 3@ROLL >= T {SUCCESSES: SUCCESSES+1}
  else {
    if REMAINING > 0 {
      if 3@ROLL+Y >= T {
        SUCCESSES: SUCCESSES+1
        REMAINING: REMAINING-1
      }
    }
  }
  if 2@ROLL >= T {SUCCESSES: SUCCESSES+1}
  else {
    if REMAINING > 0 {
      if 2@ROLL+Y >= T {
        SUCCESSES: SUCCESSES+1
        REMAINING: REMAINING-1
      }
    }
  }
  if 1@ROLL >= T {SUCCESSES: SUCCESSES+1}
  else {
    if REMAINING > 0 {
      if 1@ROLL+Y >= T {
        SUCCESSES: SUCCESSES+1
        REMAINING: REMAINING-1
      }
    }
  }


  result: SUCCESSES
}


\ N = number of dice, P = number of points, Y = amount each point boosts by: \
N: 4
P: 0
Y: 1

output [count {2..3} in [successes in Nd6 with P points]] named "overall fail/success with [P] rolls boosted by [Y]"

So in other words, there never seems to be a difference between P=2 and P=3. Anyone seeing what I must be missing?

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

You only use a point on a die if it's below the target and the point would bring it to the target or above. You only use three points if all three dice meet this condition. But in this case, two points already gives you the desired two successes. So it really is the case that the third point has no effect on the final objective. You can see the difference in the raw number of successes using output [successes in Nd6 with P points].


This mechanic seems similar to that of Soulbound, which I've also answered here. The main difference is that in Soulbound more than one point can be assigned to a single die. I used my own probability library Icepool; you can run the script in your browser here.

\$\endgroup\$
3
  • \$\begingroup\$ I guess I couldn't see the forest for the trees lol. I have other mechanics that are tied to each failure, so I guess for those, that third failure matters, but yeah. Since overall success is defined as 2+ successes, that third one only matters when looking at them individually. Thanks! \$\endgroup\$ Nov 6, 2023 at 20:57
  • 1
    \$\begingroup\$ Wouldn't 3 points let you turn 1,4,5 into 1,6,6? Or are you not allowed to use 2 points on a single die? \$\endgroup\$
    – MannerPots
    Nov 7, 2023 at 1:04
  • 3
    \$\begingroup\$ The example given in the question is ambiguous; I went by the sample code which does not allow using multiple points on the same die. If spending multiple points on the same die is allowed, then we can refer to the Soulbound case. \$\endgroup\$ Nov 7, 2023 at 1:50
2
\$\begingroup\$

According to the documentation

1@3d6 will select the highest rolled value, while 3@3d6 will select the lowest

It looks to me as if your function starts checking the lowest roll first, and then consumes your points, instead of checking the highest roll first, because you start at 3@, not at 1@.

Also, you use Y that is always just one point, instead of using the difference in points if you still have enough to close the gap.

Lastly your function returns a single number, there is no need to select positions in it.

Try this:

T: 6   \minimum success\

function: successes in ROLL:s with POINTS:n points {
  SUCCESSES: 0
  REMAINING: POINTS
  if 1@ROLL >= T {SUCCESSES: SUCCESSES+1}
  else {
    if REMAINING + 1@ROLL >= T {
        SUCCESSES: SUCCESSES+1
        REMAINING: REMAINING-(T-1@ROLL)
    }
  }
  if 2@ROLL >= T {SUCCESSES: SUCCESSES+1}
  else {
    if REMAINING + 2@ROLL >= T {
        SUCCESSES: SUCCESSES+1
        REMAINING: REMAINING-(T-2@ROLL)
      }
  }
  if 3@ROLL >= T {SUCCESSES: SUCCESSES+1}
  else {
    if REMAINING + 3@ROLL >= T {
        SUCCESSES: SUCCESSES+1
      }
  }
  result: SUCCESSES
}

P: 2 \ number of points \
output [successes in 4d6 with P points] > 1 named "overall success with [P] pts"

While keeping your overall approach, this returns between 0 and 3 possible successes, with the success numbers going up markedly as you add points, and the "> 1" gives you the overall success rate with 2 or more of them.

@HighDice roller is also right, if all you care for are 2 successes, the highest two dice positions would be sufficient to test for, and you could save yourself the entire "if 3@ROLL" branch. In that case you also could save yourself the reduction of the value of REMAINING in the "if 2@ROLL" branch, as there are no further tests on REMAINING.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .