DEV-1761: Clean up Ruleset interface #115
Merged
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.
Removes and simplifies some of the
Ruleset
andRulesetBuilder
interfaces, and integrates them into the CLI. This fixes some error handling in the CLI as well.Ruleset
now looks like this:rules/ruleset.go
Lines 3 to 13 in 2766ad7
This is a little less friendly than the old multiple method interface, but I'm planning on adding some helpers in the same release to make it simpler to take a ruleset and run a game one turn at a time.
And
RulesetBuilder
takes an explicit ruleset name through theNamedRuleset
to construct one of the standard rulesets.rules/ruleset.go
Lines 77 to 104 in 2766ad7
rules.Settings
has also been converted into a generic set of string key-value pairs, with maps and pipeline stages now parsing out settings at runtime. This loses some type safety and adds some redundant parsing, but allows us to add new settings without them being coupled to the API. The standard set of settings exposed through client requests is preserved throughclient.RulesetSettings
with a conversion helper.https://github.com/BattlesnakeOfficial/rules/blob/2766ad70f4ff1ccc399539951c0972b922b9cf21/settings.go