Conversation
Introduce a new SquidStd.Game NuGet library that hosts game mechanics on top of SquidStd.Core, keeping Core focused on infrastructure. - feat(game): add DiceExpression (readonly record struct) parsing [N]dS[±M] notation, pure constants, and the wrapped dice(...) form; whitespace-tolerant and case-insensitive on the d separator - feat(game): expose Min/Max/Average bounds and Roll() reusing the existing RandomUtils.Dice engine and BuiltInRng, so a fixed seed is reproducible - feat(game): scaffold SquidStd.Game.csproj (PublishNuget, references Core), register it in SquidStd.slnx, and reference it from SquidStd.Tests - test(game): cover parsing of all notation forms, invalid inputs (TryParse false / Parse throws), Min/Max/Average bounds, and Roll range + reproducibility
…election Introduce a random-number facade in SquidStd.Core (SquidStd.Core.Rng) that exposes multiple PRNG algorithms and gameplay helpers behind a SquidStd-owned interface, so consumers never depend on the underlying NRandom types. - feat(core): add IRandom abstraction (ints/longs/doubles, ranges, gaussian, NextBool with probability, NextBytes, Pick, Fisher-Yates Shuffle) - feat(core): add RandomFactory with Shared (thread-safe) and seeded/algorithm Create overloads; RandomAlgorithmType selects xoshiro256**/xoshiro128**/pcg32/ splitmix64/mersenne-twister/chacha - feat(core): add NRandomAdapter wrapping NRandom generators; add NRandom 2.0.2 package reference (non-cryptographic; crypto stays on CryptoUtils) - feat(core): add IWeightedList/WeightedList for O(log n) weighted selection (loot/spawn tables) on cumulative weights over IRandom - feat(game): add DiceExpression.Roll(IRandom) overload to roll from an injected reproducible source alongside the ambient BuiltInRng roll - test: cover all algorithms (reproducibility, ranges, gaussian mean, bool extremes, shuffle multiset, pick), weighted distribution, and injected dice rolls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
SquidStd.Gamelibrary and a random-number facade inSquidStd.Core.SquidStd.Game (new)
DiceExpression— parses[N]dS[±M]notation, pure constants, and thedice(...)wrapper;Roll()/Roll(IRandom),Min/Max/Average, reusing the Core roll engine.SquidStd.Core — Rng facade
IRandomabstraction (ints/longs/doubles, ranges, gaussian,NextBool(probability),NextBytes,Pick, Fisher–YatesShuffle).RandomFactorywith thread-safeSharedand seeded/algorithmCreateoverloads;RandomAlgorithmTypeselects xoshiro256**/xoshiro128**/pcg32/splitmix64/mersenne-twister/chacha.NRandomAdapterover NRandom 2.0.2 (non-cryptographic; crypto stays onCryptoUtils).IWeightedList/WeightedList— O(log n) weighted selection for loot/spawn tables.Tests
Full solution builds in Release; 64 new/updated tests green (algorithm reproducibility, ranges, gaussian mean, bool extremes, shuffle multiset, pick, weighted distribution, dice parsing + injected rolls).