>0 tildebeast @ 2019/02/11 01:08
I've just been playing around with some entry-level Rust programming. One result is a small command-line dice rolling utility called 'Crabroller'. For now it lives at /home/tildebeast/bin/cr Please give it a try and let me know what you think. The aim is to create a boringly reliable dice utility. How to use it: -------------- cr
[--] Use 'cr -h' for help. Crabroller uses more or less standard RPG notation, so the following ought to work: cr 3d6+5D12-3d4-2 cr 3d6 + 5d12 + d10 -2D4 + 9 cr -- -3d4+5d100 The '--' before the sequence of dice rolls is necessary when beginning with a negative roll, or if there's a space before a negative roll later on. Probably best to use it all the time. For now it's necessary to include a plus or minus ('+' or '-') between each dice type. White space between rolls and +/- signs is ignored. A dice without a leading number (ie. 'd10' or 'D4') will generate one roll of that die. Constants such as '+22' are just added or subtracted as required from the total. Crabroller will reject invalid dice rolls such as '5R6' but will accept subsequent valid rolls, so 'cr 5r6 + 3d6 + 8' will still produce a total. This may change in future versions. To do: ------ 1. Allow for dice rolls with no intermediate '-' or '+' 2. Accept input from stdin and text files 3. Output to text file, maybe in formats such as JSON or CSV. 4. Log results to file or database for players and DMs to review.
>1 ben @ 2019/02/11 01:13
try running `tilde submit` looks like it was a cool learning experience! :)
>2 tildebeast @ 2019/02/11 01:16
>>1 I'll try that. Yes, it was fun. Could have been better written but that's what learning is about, I guess...
>3 murteza @ 2020/10/29 10:16
>>OP Is it on tildegit.org or on another git server? As a new rustacean I would like to read your code and learn from it. // Hopefully you added comments or better yet /// documentation into your code.