{"id":24290200,"url":"https://github.com/xyaneon/xyaneon.games.dice","last_synced_at":"2025-09-25T12:31:05.963Z","repository":{"id":49129971,"uuid":"249283519","full_name":"Xyaneon/Xyaneon.Games.Dice","owner":"Xyaneon","description":"A .NET Standard 2.0 library for dice, including standard and custom dice.","archived":false,"fork":false,"pushed_at":"2024-12-31T17:50:35.000Z","size":347,"stargazers_count":6,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-10T23:29:57.571Z","etag":null,"topics":["csharp","dice","die","dotnet","games","library","netstandard","netstandard20"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Xyaneon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-22T22:22:28.000Z","updated_at":"2024-12-31T17:50:38.000Z","dependencies_parsed_at":"2022-09-05T13:21:35.665Z","dependency_job_id":"c3946b5e-a22c-4db4-a1dd-74611549dcd0","html_url":"https://github.com/Xyaneon/Xyaneon.Games.Dice","commit_stats":{"total_commits":69,"total_committers":3,"mean_commits":23.0,"dds":"0.17391304347826086","last_synced_commit":"1fc430878d261d17d1d8cf6e43e6c67b9803776a"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xyaneon%2FXyaneon.Games.Dice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xyaneon%2FXyaneon.Games.Dice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xyaneon%2FXyaneon.Games.Dice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xyaneon%2FXyaneon.Games.Dice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xyaneon","download_url":"https://codeload.github.com/Xyaneon/Xyaneon.Games.Dice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234192921,"owners_count":18793993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dice","die","dotnet","games","library","netstandard","netstandard20"],"created_at":"2025-01-16T11:17:37.948Z","updated_at":"2025-09-25T12:31:00.634Z","avatar_url":"https://github.com/Xyaneon.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Xyaneon.Games.Dice\n\n[![License](https://img.shields.io/github/license/Xyaneon/Xyaneon.Games.Dice)][License]\n[![NuGet](https://img.shields.io/nuget/v/Xyaneon.Games.Dice.svg?style=flat)][NuGet package]\n[![main](https://github.com/Xyaneon/Xyaneon.Games.Dice/actions/workflows/main.yml/badge.svg)](https://github.com/Xyaneon/Xyaneon.Games.Dice/actions/workflows/main.yml)\n[![Coverage Status](https://coveralls.io/repos/github/Xyaneon/Xyaneon.Games.Dice/badge.svg?branch=main)](https://coveralls.io/github/Xyaneon/Xyaneon.Games.Dice?branch=main)\n[![semantic-release: conventionalcommits](https://img.shields.io/badge/semantic--release-conventionalcommits-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)\n\n![Package Icon][icon]\n\nA .NET Standard 2.0 library for dice, including standard and custom dice.\n\n## Usage\n\n### Setup\n\nTo use this library, you must first install the [NuGet package][NuGet package]\nfor it, then add the following `using` statement at the top of each C# source\nfile where you plan on using it:\n\n```csharp\nusing Xyaneon.Games.Dice;\n```\n\n### Rolling standard dice\n\n#### Single rolls\n\nThis library provides several built-in classes representing standard dice,\nincluding:\n\n- D4\n- D6\n- D8\n- D10\n- D12\n- D20\n\nThese each inherit from `Dice\u003cint\u003e`. You can just call them with an empty\nconstructor to start using them right away. An optional `seed` integer can\nalso be passed into a die's constructor if you want a repeatable pseudorandom\nsequence of rolled values.\n\nAfter creation, you can simply call the `Roll` method to get a random result:\n\n```csharp\nvar die = new D6();\n\nint rollResult = die.Roll(); // Can be 1, 2, 3, 4, 5 or 6.\n```\n\n#### Multiple rolls\n\nTo avoid having to call `Roll` multiple times, you can also supply an integer\nindicating how many rolls you want, then get the results as an\n`IEnumerable\u003cint\u003e`:\n\n```csharp\nvar die = new D20();\n\n// Sample returned sequence: [6, 18, 4, 20, 1]\nIEnumerable\u003cint\u003e rollResult = die.Roll(5);\n```\n\n### Flipping coins\n\nThis library also provides a `Coin` class, which is considered to be a\ntwo-sided die. Flips are returned as `CoinFlipResult` enum values:\n\n```csharp\nvar coin = new Coin();\n\n// Could return CoinFlipResult.Heads or CoinFlipResult.Tails.\nCoinFlipResult flipResult = coin.Flip();\n```\n\n### Custom dice\n\nYou are not restricted to standard number dice. The `Die\u003cTFace\u003e` base class is\ngeneric and can be instantiated using a custom collection of your choice\nrepresenting the die's faces.\n\n```csharp\nvar colorDie = new Die\u003cColor\u003e(new Color[] {\n    Color.Red,\n    Color.Blue,\n    Color.Yellow,\n    Color.Green\n});\n\nColor rollResult = die.Roll();\n```\n\n### Symbols conversion\n\nA static `Symbols` class is also provided with constants for D6 faces, and a\ncouple conversion methods:\n- `Symbols.GetD6ValueForSymbol(char symbol)`\n- `Symbols.GetSymbolForD6Value(int value)`\n\nYou can use these to get from a ⚃ character to a 4 or vice versa, for example.\n\n## License\n\nThis library is free and open-source software provided under the MIT license.\nPlease see the [LICENSE.txt][License] file for details.\n\n[icon]: https://raw.githubusercontent.com/Xyaneon/Xyaneon.Games.Dice/main/Xyaneon.Games.Dice/images/icon.png\n[License]: https://github.com/Xyaneon/Xyaneon.Games.Dice/blob/main/LICENSE.txt\n[NuGet package]: https://www.nuget.org/packages/Xyaneon.Games.Dice/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxyaneon%2Fxyaneon.games.dice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxyaneon%2Fxyaneon.games.dice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxyaneon%2Fxyaneon.games.dice/lists"}