dimanche 19 septembre 2021

Is there a way to determine successes in a python dice roller?

I am new to programming (like very new) and I decided to make a dice roller for my favorite RPG, Vampire the Masquerade. For those who don't know, when you want to make a roll in VtM, you make dice pools of d10s (ten sided dice) and then whether you succeed or not is based on the amount of "successes" you rolled; any dice result of 6 or more.

So far, i've managed to make a basic roller that just rolls d10s:

#"d" is the number of dice
def roll(d):
    return [randint(1,10) for i in range(d)]

#Main Program
d = int(input("\nHow many dice are you rolling? > "))
results = roll(d)
print(results)

However, I'm having trouble making the program count the number of successes in the roll. I was hoping for the output to look something like

How many dice are you rolling? > 2
[5, 9]
1 success

Any advice?




Aucun commentaire:

Enregistrer un commentaire