/my_one_ring

Toy program to learn me some Rust

Primary LanguageRust

This is mostly a pet project to learn me some Rust. My goal is to make a dice roller for the One Ring™, 2nd edition, the roleplaying game published by Free League. It’s very unofficial and made for my own fun.

My goals are to:

  • [X] make dice rolls from shell
  • [X] benchmark dice pools results to simulate outcomes probabilities
  • [ ] have a nice lib which could be used in other programms

So far I really enjoy programming in Rust.

Installation

$ git clone https://github.com/nlegrand/my_one_ring.git
$ cd my_one_ring
$ cargo build
$ cargo install --path .

Usage

$ my_one_ring --help    
Usage: my_one_ring [OPTIONS] --success-dice <DICE>

Options:
  -s, --success-dice <DICE>  How many success dice
  -f, --favoured             The roll is favoured
  -i, --ill-favoured         The roll is ill-favoured
  -w, --weary                The character is weary
  -m, --miserable            The character is miserable
      --simulation           Simulate four million roll
  -h, --help                 Print help
  -V, --version              Print version

Examples

Some rolls

$ my_one_ring --success-dice 3
Feat dice: 2
Success dice: 1, 1, 4.
The result is 8 with 0 success(es)

$ my_one_ring --success-dice 3 --favoured
Feat dice (Favoured): 8, 4
Success dice: 3, 4, 5.
The result is 20 with 0 success(es)

$ my_one_ring --success-dice 3 --ill-favoured --weary
Condition: weary
Feat dice (Ill favoured): 4, 3
Success dice: 1, 2, 6 (Success icon).
The result is 9 with 1 success(es)

$ my_one_ring --success-dice 6 --ill-favoured --weary --miserable
Condition: weary
Condition: miserable
Feat dice (Ill favoured): Eye of Sauron, 3
Success dice: 1, 5, 6 (Success icon), 2, 1, 6 (Success icon).
Automatic failure!!!
The result is 17 with 2 success(es)

Rolls simulation to get outcome probabilities

  $ my_one_ring --success-dice 3 --simulation
Automatic successes: 8.326525 %
Successes:
    0: 57.859725 %
    1: 34.74185 %
    2: 6.936375 %
    3: 0.46205 %
Cumulative results (automatic successes already counted in):
    23: 13.194475 %
    22: 16.312875 %
    21: 20.492875 %
    20: 25.692975 %
    19: 31.861975 %
    18: 38.8342 %
    17: 46.351675 %
    16: 54.1348 %
    15: 61.9342 %
    14: 69.458475 %
    13: 76.44645 %
    12: 82.628675 %
    11: 87.846075 %