Releases: Samasaur1/DiceKit
Releases · Samasaur1/DiceKit
Version 0.19.0: No extraneous dependencies
Added
- Scripts to hide/unhide dev dependencies
Changed
- Documentation will no longer force-push; instead it will update
- Safety checks were removed from the release script
Fixed
- Dev dependencies, such as Danger, are now only included, downloaded, and built on CI
Version 0.18.1: Release script & documentation
Fixed
- The release script has been fixed (closes #67)
- The automatic documentation has been fixed
Version 0.18.0: Structification, Describable, and internal changes
Added
- Add release.py and updateVersion.py scripts
- Add Danger integration
- Checks that PRs to master have Version X.Y.Z: $DESCRIPTION as their title
- Checks that there are changes to the CHANGELOG
- Checks that the latest date is the date that the PR is merged (technically the date of the last Travis build)
- Checks that there are changes in tests files when source files are changed
- Checks that
swift test --generate-linuxmain
is run when new tests are written
- Ensure that all structs conform to a new type,
Describable
(CustomStringConvertible & CustomDebugStringConvertible
)
Changed
- All classes were converted to structs
- Moves everything to one pull request template so that it comes up by default
Fixed
- The image on the generated documentation is no longer cut off
- Ensures that a pull request template is applied
Removed
Update .travis.yml in case https://swiftenv.fuller.li/install.sh is down/has no SSL certificate
Version 0.17.0: Chance and Probabilities
Added
- New feature guidelines
- Issue and pull request templates
Rollable
chance(of:_:)
probabilities
— property of typeChances
chance(of:)
for rolling in ranges
CustomDie
chance(of:)
for a specific possibility
Chance
gcd(_:_:)
andlcm(_:_:)
+
,-
, and+=
operatorsnormalized
— proportionally scales every Chance until the sum is 1
Changed
Chances
- No longer has entries in the dictionary for
Roll
s where theChance
is 0
- No longer has entries in the dictionary for
Fixed
- Latest compatible version links to refer to releases rather than the tree at the specified tag
Rollable
roll(times:_:)
would crash when called like so:roll(times: 1, .dropOutsides)
Version 0.16.1: Update Swift 5 CI to Xcode 10.2
Here's what's new:
- Testing on Swift 5.0.1 and Xcode 10.2
- Fixed auto-deploying docs
Version 0.16.0: Custom dice, weighted dice, a changelog, errors, and Swift 4.2+ only
Pre-release
Here's what's new:
- A changelog (closes #14)
- Custom dice (closes #21)
- Weighted dice (closes #22)
- Updates the minimum Swift version from 4.0 to 4.2 and removes any code that is no longer needed
- Adds an
Error
enum - Converts failable initializers to throwing initializers that use the new
Error
enum - Adds more documentation
- Moves
roll(times:_:)
to an extension of theRollable
protocol so that it has a default implementation - Adds Hound and SwiftLint config
Version 0.15.0: Add averageResult and canReach functions
This is the last version to support Swift 4.0-4.0.3 and Swift 4.1-4.1.3
Here's what's new:
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
Rollable
averageResult
by @Taufi(https://github.com/Taufi)canReach(_:_:)
Die.doubleAverageResult
by @Taufi(https://github.com/Taufi)RollComparison
: denotes the comparison to use in `canReach(::)- Fixed Linux random on versions of Swift before 4.2
- Fixed in
Dice
- Include modifiers in
Dice
addition functions - Properly multiply
Die
s inDice
multiplication functions.
- Include modifiers in
Version 0.1.0
The initial release of DiceKit!
Features:
- Die
- Initialization
- Create with number of sides:
let d = Die(sides: 6)!
(it's a failable initializer) - Create from static property:
let d = Die.d6
- Create from other die:
let d = Die(copyOf: otherDie)
orlet d = otherDie.copy()
- Create with number of sides:
- Rollability
- Get a random integer from 1 to the number of sides, inclusive:
let result = die.roll()
- Get a random integer from 1 to the number of sides, inclusive:
- Swift Standard Library Protocol Conformance
- Equatable
Die.d6 == Die(sides: 6)! // true
Die.d4 != Die.d8 // true
- Comparable
Die.d6 > Die.d4 // true
Die.d10 <= Die.d10 // true
- Hashable
Die.d6.hashValue // 6
Die.d4.hashValue // 4
- Faster/usable at all in some collection types.
- CustomStringConvertable, CustomDebugStringConvertable
Die.d6.description // A six-sided die.
Die.d6.debugDescription // 1d6
- Equatable
- Initialization
- Dice
- Initialization
- Initializers
- Create with some given dice (variadic - comma-separated):
let dice = Dice(Die.d4, Die.d6, Die.d6)
- Create with some given dice (array):
let dice = Dice([Die.d4, Die.d6, Die.d6])
- Create with dice and modifier (variadic/array):
let dice = Dice(Die.d6, withModifier: 5)
orlet dice = Dice([Die.d4, Die.d8, Die.d20], withModifier: 5)
- Create from other
Dice
:let dice = Dice(copyOf: otherDice)
orlet dice = otherDice.copy()
- Create with some given dice (variadic - comma-separated):
- Operators
- Die + Die:
let dice = Die.d6 + Die.d4
(equivalent tolet dice = Dice(Die.d6, Die.d4)
) - Die + Int:
let dice = Die.d6 + 5
(equivalent tolet dice = Dice(Die.d6, withModifier: 5)
) - Dice + Dice:
let dice = Dice(Die.d6) + Dice(Die.d4, withModifier: 3)
(equivalent tolet dice = Dice(Die.d6, Die.d4, withModifier: 3)
) - Dice + Die:
let dice = Dice(Die.d4, withModifier: 3) + Die.d6
(equivalent tolet dice = Dice(Die.d6, Die.d4, withModifier: 3)
) - Dice + Int:
let dice = Dice(Die.d4, Die.d6) + 3
(equivalent tolet dice = Dice(Die.d6, Die.d4, withModifier: 3)
)
- Die + Die:
- Initializers
- Rollability
- Roll and add all contained dice and the modifier:
let result = dice.roll()
- Roll and add all contained dice and the modifier:
- Swift Standard Library Protocol Conformance
- Equatable
Dice(Die.d6, Die.d4) == Dice([Die.d4, Die(sides: 6)!]) == (Die.d4 + Die.d6) // true
Dice(Die.d6, withModifier: 3) != (Die.d6 + 3) // true
- CustomStringConvertable, CustomDebugStringConvertable
- Equatable
- Initialization
- Roll
- Initialization:
let roll = Roll(value: 5)
- Equation:
Roll(value: 5) != Roll(value: 3)
- Comparison:
Roll(value: 4) > Roll(value: 2)
- Hashable
- Description:
Roll(value: 3).description // A roll with a value of 3
- Debug Description:
Roll(value: 3).debugDescription // roll(value: 3)
- Basic operators
- Static zero property:
let roll = Roll.zero
- Initialization:
- Rollable
- Defines something that is rollable.
- Rollability:
let result = rollable.roll()
- Implementations:
let r: Rollable = Die.d6
let r: Rollable = Dice(Die.d6)