fluffle / sp0rkle

sp0rkle is dead, long live sp0rkle
irc://irc.pl0rt.org/#ed
8 stars 4 forks source link

feature: roll the dice #84

Open marqh opened 2 years ago

marqh commented 2 years ago

feed me tips and target points on coding and i'll happily implement

interface suggestion:

sp0rkle: roll <n> d<d>

args:

behaviour:

return dice roll number set for n dice of size d integer list based on (pseudo)random number generator

e.g.

sp0rkle: roll d4
3
sp0rkle roll 2 d6
3 5
sp0rkle roll 3 d12
1 11 8
fluffle commented 2 years ago

Heyoo, thanks for the suggestion :-)

This probably belongs in drivers/decisiondriver, which does random number stuff. If I was you i'd make the spaces around the d optional -- NdX is pretty common dnd terminology aiui.

You might find the Lexer in package util helpful for string parsing. You can see some simple example usage in drivers/decisiondriver/decisiondriver.go, in the quoteSplit function.