DEV 1676: Add maps helper functions (#111)
* add utility methods to Editor and BoardStateEditor * add Meta.Validate * allow setting Meta.MinPlayers to zero * remove uints in map sizes * use Meta.Validate in HazardPitsMap
This commit is contained in:
parent
c5810d8604
commit
c4247945ca
7 changed files with 701 additions and 83 deletions
|
|
@ -21,8 +21,8 @@ func TestCastleWallHazardsMap(t *testing.T) {
|
|||
|
||||
tests := []struct {
|
||||
Map maps.GameMap
|
||||
Width uint
|
||||
Height uint
|
||||
Width int
|
||||
Height int
|
||||
}{
|
||||
{maps.CastleWallMediumHazardsMap{}, 11, 11},
|
||||
{maps.CastleWallLargeHazardsMap{}, 19, 19},
|
||||
|
|
@ -31,7 +31,7 @@ func TestCastleWallHazardsMap(t *testing.T) {
|
|||
|
||||
// check all the supported sizes
|
||||
for _, test := range tests {
|
||||
state = rules.NewBoardState(int(test.Width), int(test.Height))
|
||||
state = rules.NewBoardState(test.Width, test.Height)
|
||||
state.Snakes = append(state.Snakes, rules.Snake{ID: "1", Body: []rules.Point{}})
|
||||
editor = maps.NewBoardStateEditor(state)
|
||||
require.Empty(t, state.Hazards)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue