/NDiceBag

A fluent dice library, you know, for games!

Primary LanguageC#OtherNOASSERTION

NDiceBag

A fluent dice library, you know, for games!

Release Notes

Version 1.1

  • Added this.GrabPercentileDice()
  • Added DivisionRoundingUp() and DivisionRoundingDown()
  • Added Basic Integer Operators (+, -, and *)
  • Improved Tests (now test against 1000 rolls)

Version 1.0

  • Initial Release

Using NDiceBag

  1. Reference NDiceBag.dll
  2. Add using NDiceBag; to your class
  3. Grab some dice!

Grab Some Dice!

  1. 3d6 would be 3.d()
  2. 3d4 would be 3.d(4)
  3. 3d4x10 would be 3.d(4).x(10) or 3.d(4) * 10
  4. 3d4+5 would be 3.d(4).Plus(5) or 3.d(4) + 5
  5. 3d4-2 would be 3.d(4).Minus(2) or 3.d(4) - 2
  6. 1d10 / 2 rounding up would be 1.d(10).DivideRoundingUp(2)
  7. 1d10 / 2 rounding down would be 1.d(10).DivideRoundingDown(2)
  8. 3d4 + 2d8 would be 3.d(4) + 2.d(8)
  9. 3d4 - 2d12 would be 3.d(4) - 2.d(12)
  10. 3d4 * 1d20 would be 3.d(4) * 1.d(20)
  11. 3d4d10 would be 3.d(4).d(10)

Roll Some Dice

  1. All dice object instances contain .Roll()
  2. Operators return a dice object: (3.d(4) + 1.d()).Roll()
  3. Modifiers are chain-able: 3.d().x(10).Plus(2).Minus(5).Roll() or (3.d() * 10 + 2 - 5).Roll()
  4. Operators are chain-able: (3.d(8) + 2.d(4) - 3.d(6)).Roll()

Input Needed (and Pull-Requests Accepted)

  1. Thoughts on string parsing (Regular Expressions FTW/FTL?)
  2. Possible ToString functionality (e.g. 3.d().ToString() == "3d6")
  3. Thoughts on division operators (assume default rounding down?)

Coming Soon

  1. String parsing
  2. More cool stuff
  3. Easy Percentile Dice
  4. Division?

Credit Where it is Due

Mersenne Twister algorithm courtesy of Rory Plaire (codekaizen@gmail.com), Copyright 2007 - 2008