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:
parent
639362ef46
commit
82e1999126
50 changed files with 1349 additions and 1610 deletions
|
|
@ -82,11 +82,10 @@ func TestUpdateBoard(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
previousBoardState := &rules.BoardState{
|
||||
Turn: 0,
|
||||
Food: []rules.Point{{X: 0, Y: 1}},
|
||||
Hazards: []rules.Point{{X: 3, Y: 4}},
|
||||
Snakes: []rules.Snake{
|
||||
previousBoardState := rules.NewBoardState(5, 5).
|
||||
WithFood([]rules.Point{{X: 0, Y: 1}}).
|
||||
WithHazards([]rules.Point{{X: 3, Y: 4}}).
|
||||
WithSnakes([]rules.Snake{
|
||||
{
|
||||
ID: "1",
|
||||
Health: 100,
|
||||
|
|
@ -96,11 +95,9 @@ func TestUpdateBoard(t *testing.T) {
|
|||
{X: 6, Y: 2},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
})
|
||||
maps.TestMap(testMap.ID(), testMap, func() {
|
||||
boardState, err := maps.UpdateBoard(testMap.ID(), previousBoardState, rules.Settings{})
|
||||
boardState, err := maps.PostUpdateBoard(testMap, previousBoardState, rules.Settings{})
|
||||
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue