DEV-280: Extract board generation out of rules.Ruleset (#51)
* extract board generation out of rules.Ruleset * update comment and remove redundant interface check * clone boardState in constrictor to respect the ModifyBoardState interface
This commit is contained in:
parent
e416384007
commit
015b681f14
8 changed files with 1006 additions and 917 deletions
|
|
@ -236,11 +236,15 @@ func initializeBoardFromArgs(ruleset rules.Ruleset, snakes []Battlesnake) *rules
|
|||
for _, snake := range snakes {
|
||||
snakeIds = append(snakeIds, snake.ID)
|
||||
}
|
||||
state, err := ruleset.CreateInitialBoardState(Width, Height, snakeIds)
|
||||
state, err := rules.CreateDefaultBoardState(Width, Height, snakeIds)
|
||||
if err != nil {
|
||||
log.Panic("[PANIC]: Error Initializing Board State")
|
||||
panic(err)
|
||||
}
|
||||
state, err = ruleset.ModifyInitialBoardState(state)
|
||||
if err != nil {
|
||||
log.Panic("[PANIC]: Error Initializing Board State")
|
||||
}
|
||||
|
||||
for _, snake := range snakes {
|
||||
requestBody := getIndividualBoardStateForSnake(state, snake, ruleset)
|
||||
u, _ := url.ParseRequestURI(snake.URL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue