change map support for large #'s of snakes (#92)
* change map support for large #'s of snakes * test square board fn * format comment * add whitespace * better support large #'s of snakes on small boards * include an intermediate xlarge size
This commit is contained in:
parent
08cb7ae61d
commit
663c377cc4
10 changed files with 174 additions and 101 deletions
|
|
@ -19,16 +19,20 @@ func (m EmptyMap) Meta() Metadata {
|
|||
Name: "Empty",
|
||||
Description: "Default snake placement with no food",
|
||||
Author: "Battlesnake",
|
||||
Version: 1,
|
||||
Version: 2,
|
||||
MinPlayers: 1,
|
||||
MaxPlayers: 8,
|
||||
BoardSizes: AnySize(),
|
||||
MaxPlayers: 16,
|
||||
BoardSizes: OddSizes(rules.BoardSizeSmall, rules.BoardSizeXXLarge),
|
||||
}
|
||||
}
|
||||
|
||||
func (m EmptyMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error {
|
||||
rand := settings.GetRand(0)
|
||||
|
||||
if len(initialBoardState.Snakes) > int(m.Meta().MaxPlayers) {
|
||||
return rules.ErrorTooManySnakes
|
||||
}
|
||||
|
||||
snakeIDs := make([]string, 0, len(initialBoardState.Snakes))
|
||||
for _, snake := range initialBoardState.Snakes {
|
||||
snakeIDs = append(snakeIDs, snake.ID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue