Skip to content

Usage Die / Usage Dots probability chart help #240

Answered by HighDiceRoller
simonefelli asked this question in Q&A
Discussion options

You must be logged in to vote

Glad to get your question. Here's a solution:

from icepool import d

die_sizes = [4, 6, 8, 10, 12, 20]

def usage_die(size, explode_depth=None):
    if explode_depth is None:
        explode_depth = size * 3
    index = die_sizes.index(size)
    if index == 0:
        return 1 + (d(size) > 2).explode(depth=explode_depth)
    else:
        return 1 + (d(size) > 2).explode(depth=explode_depth) + usage_die(die_sizes[index - 1])

for size in [4, 6, 8, 10, 12, 20]:
    output(usage_die(size), f'usage d{size}')

def usage_dot(size, t, explode_depth=None):
    if explode_depth is None:
        explode_depth = size * 3
    return t @ (1 + (d(size) > 2).explode(depth=explode_depth))
    
output(us…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by simonefelli
Comment options

You must be logged in to vote
1 reply
@HighDiceRoller
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants