File tree Expand file tree Collapse file tree 1 file changed +2
-23
lines changed
Expand file tree Collapse file tree 1 file changed +2
-23
lines changed Original file line number Diff line number Diff line change @@ -32,29 +32,8 @@ func (m SnailModeMap) Meta() Metadata {
3232
3333// SetupBoard here is pretty 'standard' and doesn't do any special setup for this game mode
3434func (m SnailModeMap ) SetupBoard (initialBoardState * rules.BoardState , settings rules.Settings , editor Editor ) error {
35- rand := settings .GetRand (0 )
36-
37- if len (initialBoardState .Snakes ) > int (m .Meta ().MaxPlayers ) {
38- return rules .ErrorTooManySnakes
39- }
40-
41- snakeIDs := make ([]string , 0 , len (initialBoardState .Snakes ))
42- for _ , snake := range initialBoardState .Snakes {
43- snakeIDs = append (snakeIDs , snake .ID )
44- }
45-
46- tempBoardState := rules .NewBoardState (initialBoardState .Width , initialBoardState .Height )
47- err := rules .PlaceSnakesAutomatically (rand , tempBoardState , snakeIDs )
48- if err != nil {
49- return err
50- }
51-
52- // Copy snakes from temp board state
53- for _ , snake := range tempBoardState .Snakes {
54- editor .PlaceSnake (snake .ID , snake .Body , snake .Health )
55- }
56-
57- return nil
35+ // Use StandardMap to populate snakes and food
36+ return StandardMap {}.SetupBoard (initialBoardState , settings , editor )
5837}
5938
6039// storeTailLocation returns an offboard point that corresponds to the given point.
You can’t perform that action at this time.
0 commit comments