Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added info about C# port. #14

Merged
merged 1 commit into from
Jul 4, 2018
Merged

Added info about C# port. #14

merged 1 commit into from
Jul 4, 2018

Conversation

MrTarantula
Copy link
Contributor

I created a C# port of gamblers-dice. It's a .Net Standard 2.0 library. It includes a gambler's die and a fair die (inspired by the Java port). There are also 3 constructors:

  • GamblersDie() - default 6-sided die
  • GamblersDie(#) - die with # sides
  • GamblersDie([#, #, #, #]) - die with the x sides where x is array length, and each side has # weight.

The third constructor can accept an array or just multiple integers (called params in C#, rest parameters in JS). I did this so I can persist the state to storage (which I call weight in my port). I also made the weight publicly accessible for this reason.

@MrTarantula
Copy link
Contributor Author

I also added some uniformity tests, but they're a bit flaky. They don't always stay strictly within the 0.001 uniformity tolerance. I don't know whether that's due to precision or something I'm doing wrong. The tests fail every 10 runs or so, just slightly out of tolerance. I can live with it.

@MrTarantula
Copy link
Contributor Author

I upped the precision on the tests and they're no longer flaky at 1,000,000 rolls.

@xori
Copy link
Owner

xori commented Jul 4, 2018

I like it

@xori xori merged commit b65d37e into xori:master Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants