I’ve been playing a lot of roguelikes lately (for those interested: mostly ADOM, a little bit of Sil) and because those games use a lot of dice rolls in their gameplay mechanics, I wrote myself a small utility to compute the minimum, maximum, and expected value of a dice roll in order to make more informed decisions (e.g., which weapon is likely to be better) before I inevitably YASD. For example:
~$ ev 1d6 3d4+1 INVALID 2d10-1 1d6 min: 1 max: 6 ev : 3.5 3d4+1 min: 4 max: 13 ev : 8.5 ev: invalid format: INVALID 2d10-1 min: 1 max: 19 ev : 10 ~$
The program iterates over the arguments, tries to parse them as rolls and prints the roll statistics or an error message. I’ve been wondering what the program should do when no arguments are passed. I figure I have three possible options:
I’m curious to know what people here feel would be the more UNIXy and/or natural choice? Certainly (1) was easiest to implement since it treats zero arguments the exact same way it treats any other number of arguments.