Skip to content

Commit

Permalink
clarify reroll_to_pool depth is effectively 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ajul committed Jul 2, 2024
1 parent 30f9e29 commit 466086a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/icepool/population/die.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,16 +1017,19 @@ def reroll_to_pool(
) -> 'icepool.MultisetGenerator[T_co, tuple[int]]':
"""EXPERIMENTAL: Applies a limited number of rerolls shared across a pool.
Each die can only be rerolled once, and no more than `max_rerolls` dice
may be rerolled.
Each die can only be rerolled once (effectively `depth=1`), and no more
than `max_rerolls` dice may be rerolled.
Args:
rolls: How many dice in the pool.
which: Selects which outcomes are eligible to be rerolled. Options:
* A collection of outcomes to reroll.
* A callable that takes an outcome and returns `True` if it
could be rerolled.
max_rerolls: The maximum number of dice to reroll.
max_rerolls: The maximum number of dice to reroll.
Note that each die can only be rerolled once, so if the number
of eligible dice is less than this, the excess rerolls have no
effect.
star: Whether outcomes should be unpacked into separate arguments
before sending them to a callable `which`.
If not provided, this will be guessed based on the function
Expand Down Expand Up @@ -1104,7 +1107,7 @@ def make_pool(initial_rerollable, rerolled_to_rerollable,
return not_rerollable_die.pool(not_rerollable)
else:
raise ValueError(
f"Invalid reroll_priority '{mode}'. Allowed values are 'random', 'lowest', and 'highest'."
f"Invalid reroll_priority '{mode}'. Allowed values are 'random', 'lowest', 'highest', 'drop'."
)

denominator = self.denominator()**(rolls + min(rolls, max_rerolls))
Expand Down

0 comments on commit 466086a

Please sign in to comment.