DEV-1761: New rules API (#118)

* DEV-1761: Clean up Ruleset interface (#115)

* remove legacy ruleset types and simplify ruleset interface

* remove unnecessary settings argument from Ruleset interface

* decouple rules.Settings from client API and store settings as strings

* DEV 1761: Add new BoardState and Point fields (#117)

* add Point.TTL, Point.Value, GameState and PointState to BoardState

* allow maps to access BoardState.GameState,PointState

* add PreUpdateBoard and refactor snail_mode with it

* fix bug where an extra turn was printed to the console

* fix formatting

* fix lint errors

Co-authored-by: JonathanArns <jonathan.arns@googlemail.com>
This commit is contained in:
Rob O'Dwyer 2022-10-28 16:49:49 -07:00 committed by GitHub
parent 639362ef46
commit 82e1999126
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 1349 additions and 1610 deletions

View file

@ -38,7 +38,7 @@ func TestHazardPitsMap(t *testing.T) {
state = rules.NewBoardState(int(11), int(11))
m = maps.HazardPitsMap{}
settings.RoyaleSettings.ShrinkEveryNTurns = 1
settings = rules.NewSettingsWithParams(rules.ParamShrinkEveryNTurns, "1")
editor = maps.NewBoardStateEditor(state)
require.Empty(t, state.Hazards)
err = m.SetupBoard(state, settings, editor)
@ -47,7 +47,7 @@ func TestHazardPitsMap(t *testing.T) {
// Verify the hazard progression through the turns
for i := 0; i < 16; i++ {
state.Turn = i
err = m.UpdateBoard(state, settings, editor)
err = m.PostUpdateBoard(state, settings, editor)
require.NoError(t, err)
if i == 1 {
require.Len(t, state.Hazards, 21)