change all "int32" types to "int" (#75)
This commit is contained in:
parent
2d8342018e
commit
3bd1e47bb4
19 changed files with 176 additions and 176 deletions
|
|
@ -43,7 +43,7 @@ type Editor interface {
|
|||
RemoveHazard(rules.Point)
|
||||
|
||||
// Updates the body and health of a snake.
|
||||
PlaceSnake(id string, body []rules.Point, health int32)
|
||||
PlaceSnake(id string, body []rules.Point, health int)
|
||||
}
|
||||
|
||||
// An Editor backed by a BoardState.
|
||||
|
|
@ -91,7 +91,7 @@ func (editor *BoardStateEditor) RemoveHazard(p rules.Point) {
|
|||
}
|
||||
}
|
||||
|
||||
func (editor *BoardStateEditor) PlaceSnake(id string, body []rules.Point, health int32) {
|
||||
func (editor *BoardStateEditor) PlaceSnake(id string, body []rules.Point, health int) {
|
||||
for index, snake := range editor.Snakes {
|
||||
if snake.ID == id {
|
||||
editor.Snakes[index].Body = body
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import "github.com/BattlesnakeOfficial/rules"
|
|||
|
||||
// SetupBoard is a shortcut for looking up a map by ID and initializing a new board state with it.
|
||||
func SetupBoard(mapID string, settings rules.Settings, width, height int, snakeIDs []string) (*rules.BoardState, error) {
|
||||
boardState := rules.NewBoardState(int32(width), int32(height))
|
||||
boardState := rules.NewBoardState(width, height)
|
||||
|
||||
rules.InitializeSnakes(boardState, snakeIDs)
|
||||
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ func (m RoyaleHazardsMap) UpdateBoard(lastBoardState *rules.BoardState, settings
|
|||
randGenerator := settings.GetRand(0)
|
||||
|
||||
numShrinks := turn / settings.RoyaleSettings.ShrinkEveryNTurns
|
||||
minX, maxX := int32(0), lastBoardState.Width-1
|
||||
minY, maxY := int32(0), lastBoardState.Height-1
|
||||
for i := int32(0); i < numShrinks; i++ {
|
||||
minX, maxX := 0, lastBoardState.Width-1
|
||||
minY, maxY := 0, lastBoardState.Height-1
|
||||
for i := 0; i < numShrinks; i++ {
|
||||
switch randGenerator.Intn(4) {
|
||||
case 0:
|
||||
minX += 1
|
||||
|
|
@ -62,8 +62,8 @@ func (m RoyaleHazardsMap) UpdateBoard(lastBoardState *rules.BoardState, settings
|
|||
}
|
||||
}
|
||||
|
||||
for x := int32(0); x < lastBoardState.Width; x++ {
|
||||
for y := int32(0); y < lastBoardState.Height; y++ {
|
||||
for x := 0; x < lastBoardState.Width; x++ {
|
||||
for y := 0; y < lastBoardState.Height; y++ {
|
||||
if x < minX || x > maxX || y < minY || y > maxY {
|
||||
editor.AddHazard(rules.Point{X: x, Y: y})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue