Documentation ¶
Index ¶
- Constants
- Variables
- func AnySize() sizes
- func FixedSizes(a Dimensions, b ...Dimensions) sizes
- func List() []string
- func OddSizes(min, max int) sizes
- func PlaceFoodFixed(rand rules.Rand, initialBoardState *rules.BoardState, editor Editor) error
- func PlaceSnakesInQuadrants(rand rules.Rand, editor Editor, snakes []rules.Snake, ...) error
- func PostUpdateBoard(gameMap GameMap, previousBoardState *rules.BoardState, settings rules.Settings) (*rules.BoardState, error)
- func PreUpdateBoard(gameMap GameMap, previousBoardState *rules.BoardState, settings rules.Settings) (*rules.BoardState, error)
- func RegisterMap(id string, m GameMap)
- func SetupBoard(mapID string, settings rules.Settings, width, height int, snakeIDs []string) (*rules.BoardState, error)
- func TestMap(id string, m GameMap, callback func())
- type ArcadeMazeMap
- func (m ArcadeMazeMap) ID() string
- func (m ArcadeMazeMap) Meta() Metadata
- func (m ArcadeMazeMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ArcadeMazeMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ArcadeMazeMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type BoardStateEditor
- func (editor *BoardStateEditor) AddFood(p rules.Point)
- func (editor *BoardStateEditor) AddHazard(p rules.Point)
- func (editor *BoardStateEditor) ClearFood()
- func (editor *BoardStateEditor) ClearHazards()
- func (editor *BoardStateEditor) FilterUnoccupiedPoints(targets []rules.Point, snakes, hazards, food bool) []rules.Point
- func (editor *BoardStateEditor) Food() []rules.Point
- func (editor *BoardStateEditor) GameState() map[string]string
- func (editor *BoardStateEditor) Hazards() []rules.Point
- func (editor *BoardStateEditor) IsOccupied(point rules.Point, snakes, hazards, food bool) bool
- func (editor *BoardStateEditor) OccupiedPoints(snakes, hazards, food bool) map[rules.Point]bool
- func (editor *BoardStateEditor) PlaceSnake(id string, body []rules.Point, health int)
- func (editor *BoardStateEditor) PlaceSnakesRandomlyAtPositions(rand rules.Rand, snakes []rules.Snake, heads []rules.Point, bodyLength int) error
- func (editor *BoardStateEditor) PointState() map[rules.Point]int
- func (editor *BoardStateEditor) RemoveFood(p rules.Point)
- func (editor *BoardStateEditor) RemoveHazard(p rules.Point)
- func (editor *BoardStateEditor) ShufflePoints(rand rules.Rand, points []rules.Point)
- func (editor *BoardStateEditor) SnakeBodies() map[string][]rules.Point
- type CastleWallExtraLargeHazardsMap
- func (m CastleWallExtraLargeHazardsMap) ID() string
- func (m CastleWallExtraLargeHazardsMap) Meta() Metadata
- func (m CastleWallExtraLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m CastleWallExtraLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m CastleWallExtraLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type CastleWallLargeHazardsMap
- func (m CastleWallLargeHazardsMap) ID() string
- func (m CastleWallLargeHazardsMap) Meta() Metadata
- func (m CastleWallLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m CastleWallLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m CastleWallLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type CastleWallMediumHazardsMap
- func (m CastleWallMediumHazardsMap) ID() string
- func (m CastleWallMediumHazardsMap) Meta() Metadata
- func (m CastleWallMediumHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m CastleWallMediumHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m CastleWallMediumHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type ColumnsHazardsMap
- func (m ColumnsHazardsMap) ID() string
- func (m ColumnsHazardsMap) Meta() Metadata
- func (m ColumnsHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ColumnsHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ColumnsHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type ConcentricRingsHazardsMap
- func (m ConcentricRingsHazardsMap) ID() string
- func (m ConcentricRingsHazardsMap) Meta() Metadata
- func (m ConcentricRingsHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ConcentricRingsHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ConcentricRingsHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type Dimensions
- type DirectionalExpandingBoxMap
- func (m DirectionalExpandingBoxMap) ID() string
- func (m DirectionalExpandingBoxMap) Meta() Metadata
- func (m DirectionalExpandingBoxMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m DirectionalExpandingBoxMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m DirectionalExpandingBoxMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type Editor
- type EmptyMap
- func (m EmptyMap) ID() string
- func (m EmptyMap) Meta() Metadata
- func (m EmptyMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m EmptyMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m EmptyMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type ExpandingBoxMap
- func (m ExpandingBoxMap) ID() string
- func (m ExpandingBoxMap) Meta() Metadata
- func (m ExpandingBoxMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ExpandingBoxMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ExpandingBoxMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type ExpandingScatterMap
- func (m ExpandingScatterMap) ID() string
- func (m ExpandingScatterMap) Meta() Metadata
- func (m ExpandingScatterMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ExpandingScatterMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ExpandingScatterMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type GameMap
- type HazardPitsMap
- func (m HazardPitsMap) AddHazardPits(board *rules.BoardState, settings rules.Settings, editor Editor)
- func (m HazardPitsMap) ID() string
- func (m HazardPitsMap) Meta() Metadata
- func (m HazardPitsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m HazardPitsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m HazardPitsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type HealingPoolsMap
- func (m HealingPoolsMap) ID() string
- func (m HealingPoolsMap) Meta() Metadata
- func (m HealingPoolsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m HealingPoolsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m HealingPoolsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type InnerBorderHazardsMap
- func (m InnerBorderHazardsMap) ID() string
- func (m InnerBorderHazardsMap) Meta() Metadata
- func (m InnerBorderHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m InnerBorderHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m InnerBorderHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type IslandsAndBridgesLargeHazardsMap
- func (m IslandsAndBridgesLargeHazardsMap) ID() string
- func (m IslandsAndBridgesLargeHazardsMap) Meta() Metadata
- func (m IslandsAndBridgesLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m IslandsAndBridgesLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m IslandsAndBridgesLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type IslandsAndBridgesMediumHazardsMap
- func (m IslandsAndBridgesMediumHazardsMap) ID() string
- func (m IslandsAndBridgesMediumHazardsMap) Meta() Metadata
- func (m IslandsAndBridgesMediumHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m IslandsAndBridgesMediumHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m IslandsAndBridgesMediumHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type MapRegistry
- type Metadata
- type RiverAndBridgesExtraLargeHazardsMap
- func (m RiverAndBridgesExtraLargeHazardsMap) ID() string
- func (m RiverAndBridgesExtraLargeHazardsMap) Meta() Metadata
- func (m RiverAndBridgesExtraLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m RiverAndBridgesExtraLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m RiverAndBridgesExtraLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type RiverAndBridgesLargeHazardsMap
- func (m RiverAndBridgesLargeHazardsMap) ID() string
- func (m RiverAndBridgesLargeHazardsMap) Meta() Metadata
- func (m RiverAndBridgesLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m RiverAndBridgesLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m RiverAndBridgesLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type RiverAndBridgesMediumHazardsMap
- func (m RiverAndBridgesMediumHazardsMap) ID() string
- func (m RiverAndBridgesMediumHazardsMap) Meta() Metadata
- func (m RiverAndBridgesMediumHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m RiverAndBridgesMediumHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m RiverAndBridgesMediumHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type RoyaleHazardsMap
- func (m RoyaleHazardsMap) ID() string
- func (m RoyaleHazardsMap) Meta() Metadata
- func (m RoyaleHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m RoyaleHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m RoyaleHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type ScatterFillMap
- func (m ScatterFillMap) ID() string
- func (m ScatterFillMap) Meta() Metadata
- func (m ScatterFillMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ScatterFillMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m ScatterFillMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type SinkholesMap
- func (m SinkholesMap) ID() string
- func (m SinkholesMap) Meta() Metadata
- func (m SinkholesMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m SinkholesMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m SinkholesMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type SnailModeMap
- func (m SnailModeMap) ID() string
- func (m SnailModeMap) Meta() Metadata
- func (m SnailModeMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m SnailModeMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m SnailModeMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type SoloMazeMap
- func (m SoloMazeMap) AdjustPosition(mazePosition rules.Point, actualBoardSize int, boardHeight int, boardWidth int) rules.Point
- func (m SoloMazeMap) CreateMaze(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor, ...) error
- func (m SoloMazeMap) ID() string
- func (m SoloMazeMap) Meta() Metadata
- func (m SoloMazeMap) PlaceFood(boardState *rules.BoardState, settings rules.Settings, editor Editor, ...)
- func (m SoloMazeMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m SoloMazeMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m SoloMazeMap) ReadBitState(boardState *rules.BoardState) (int64, error)
- func (m SoloMazeMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m SoloMazeMap) SubdivideRoom(tempBoardState *rules.BoardState, rand rules.Rand, lowPoint rules.Point, ...) bool
- func (m SoloMazeMap) WriteBitState(boardState *rules.BoardState, state int64, editor Editor)
- type SpiralHazardsMap
- func (m SpiralHazardsMap) ID() string
- func (m SpiralHazardsMap) Meta() Metadata
- func (m SpiralHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m SpiralHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m SpiralHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type StandardMap
- func (m StandardMap) ID() string
- func (m StandardMap) Meta() Metadata
- func (m StandardMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m StandardMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m StandardMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- type StubMap
- func (m StubMap) ID() string
- func (StubMap) Meta() Metadata
- func (m StubMap) PostUpdateBoard(previousBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m StubMap) PreUpdateBoard(previousBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
- func (m StubMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
Constants ¶
const ( TAG_EXPERIMENTAL = "experimental" // experimental map, only available via CLI TAG_SNAKE_PLACEMENT = "snake-placement" // map overrides default snake placement TAG_HAZARD_PLACEMENT = "hazard-placement" // map places hazards TAG_FOOD_PLACEMENT = "food-placement" // map overrides or adds to default food placement )
const DEBUG_MAZE_GENERATION = false
When this is flipped to `true` TWO things happen
- More println style debugging is done
- We print out the current game board in between each room sub-division, and wait for the CLI User to hit enter to sub-divide the next room. This allows you to see the maze get generated in realtime, which was super useful while debugging issues in the maze generation
const EVIL_MODE_DISTANCE_TO_FOOD = 5
const INITIAL_MAZE_SIZE = 7
const MAX_TRIES = 100
const TURNS_AT_MAX_SIZE = 5
Variables ¶
var ArcadeMazeHazards []rules.Point = []rules.Point{}/* 187 elements not displayed */
Functions ¶
func AnySize ¶ added in v1.1.10
func AnySize() sizes
AnySize creates sizes for a board that has no fixed sizes (supports unlimited sizes).
func FixedSizes ¶ added in v1.1.10
func FixedSizes(a Dimensions, b ...Dimensions) sizes
FixedSizes creates dimensions for a board that has 1 or more fixed sizes. Examples: - FixedSizes(Dimension{9,11}) supports only a width of 9 and a height of 11. - FixedSizes(Dimensions{11,11},Dimensions{19,19}) supports sizes 11x11 and 19x19
func List ¶ added in v1.1.15
func List() []string
List returns a list of maps registered to the global registry.
func OddSizes ¶ added in v1.1.13
func OddSizes(min, max int) sizes
OddSizes generates square (width = height) board sizes with an odd number of positions in the vertical and horizontal directions. Examples:
- OddSizes(11,21) produces [(11,11), (13,13), (15,15), (17,17), (19,19), (21,21)]
func PlaceFoodFixed ¶ added in v1.1.20
func PlaceSnakesInQuadrants ¶ added in v1.1.20
func PostUpdateBoard ¶ added in v1.2.0
func PostUpdateBoard(gameMap GameMap, previousBoardState *rules.BoardState, settings rules.Settings) (*rules.BoardState, error)
func PreUpdateBoard ¶ added in v1.2.0
func PreUpdateBoard(gameMap GameMap, previousBoardState *rules.BoardState, settings rules.Settings) (*rules.BoardState, error)
PreUpdateBoard updates a board state with a map.
func RegisterMap ¶
RegisterMap adds a map to the global registry.
func SetupBoard ¶
func SetupBoard(mapID string, settings rules.Settings, width, height int, snakeIDs []string) (*rules.BoardState, error)
SetupBoard is a shortcut for looking up a map by ID and initializing a new board state with it.
Types ¶
type ArcadeMazeMap ¶ added in v1.1.5
type ArcadeMazeMap struct{}
func (ArcadeMazeMap) ID ¶ added in v1.1.5
func (m ArcadeMazeMap) ID() string
func (ArcadeMazeMap) Meta ¶ added in v1.1.5
func (m ArcadeMazeMap) Meta() Metadata
func (ArcadeMazeMap) PostUpdateBoard ¶ added in v1.2.0
func (m ArcadeMazeMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ArcadeMazeMap) PreUpdateBoard ¶ added in v1.2.0
func (m ArcadeMazeMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ArcadeMazeMap) SetupBoard ¶ added in v1.1.5
func (m ArcadeMazeMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type BoardStateEditor ¶
type BoardStateEditor struct {
// contains filtered or unexported fields
}
An Editor backed by a BoardState.
func NewBoardStateEditor ¶
func NewBoardStateEditor(boardState *rules.BoardState) *BoardStateEditor
func (*BoardStateEditor) AddFood ¶
func (editor *BoardStateEditor) AddFood(p rules.Point)
func (*BoardStateEditor) AddHazard ¶
func (editor *BoardStateEditor) AddHazard(p rules.Point)
func (*BoardStateEditor) ClearFood ¶
func (editor *BoardStateEditor) ClearFood()
func (*BoardStateEditor) ClearHazards ¶
func (editor *BoardStateEditor) ClearHazards()
func (*BoardStateEditor) FilterUnoccupiedPoints ¶ added in v1.1.20
func (editor *BoardStateEditor) FilterUnoccupiedPoints(targets []rules.Point, snakes, hazards, food bool) []rules.Point
Given a list of points, return only those that are unoccupied by snake bodies, food, and/or hazards.
func (*BoardStateEditor) Food ¶ added in v1.1.20
func (editor *BoardStateEditor) Food() []rules.Point
Get the locations of food currently on the board. Note: the return value is read-only.
func (*BoardStateEditor) GameState ¶ added in v1.2.0
func (editor *BoardStateEditor) GameState() map[string]string
Get an editable reference to the BoardState's GameState field
func (*BoardStateEditor) Hazards ¶ added in v1.1.20
func (editor *BoardStateEditor) Hazards() []rules.Point
Get the locations of hazards currently on the board. Note: the return value is read-only.
func (*BoardStateEditor) IsOccupied ¶ added in v1.1.20
func (editor *BoardStateEditor) IsOccupied(point rules.Point, snakes, hazards, food bool) bool
Returns true if the provided point on the board is occupied by a snake body, food, and/or hazard.
func (*BoardStateEditor) OccupiedPoints ¶ added in v1.1.20
func (editor *BoardStateEditor) OccupiedPoints(snakes, hazards, food bool) map[rules.Point]bool
Get a set of all points on the board the are occupied by snake bodies, food, and/or hazards. The value for each point will be set to true in the return value if that point is occupied by one of the selected objects.
func (*BoardStateEditor) PlaceSnake ¶
func (editor *BoardStateEditor) PlaceSnake(id string, body []rules.Point, health int)
func (*BoardStateEditor) PlaceSnakesRandomlyAtPositions ¶ added in v1.1.20
func (editor *BoardStateEditor) PlaceSnakesRandomlyAtPositions(rand rules.Rand, snakes []rules.Snake, heads []rules.Point, bodyLength int) error
Given a list of Snakes and a list of head coordinates, randomly place the snakes on those coordinates, or return an error if placement of all Snakes is impossible.
func (*BoardStateEditor) PointState ¶ added in v1.2.0
func (editor *BoardStateEditor) PointState() map[rules.Point]int
Get an editable reference to the BoardState's PointState field
func (*BoardStateEditor) RemoveFood ¶
func (editor *BoardStateEditor) RemoveFood(p rules.Point)
func (*BoardStateEditor) RemoveHazard ¶
func (editor *BoardStateEditor) RemoveHazard(p rules.Point)
func (*BoardStateEditor) ShufflePoints ¶ added in v1.1.20
func (editor *BoardStateEditor) ShufflePoints(rand rules.Rand, points []rules.Point)
func (*BoardStateEditor) SnakeBodies ¶ added in v1.1.20
func (editor *BoardStateEditor) SnakeBodies() map[string][]rules.Point
Get the bodies of all non-eliminated snakes currently on the board. Note: the return value is read-only.
type CastleWallExtraLargeHazardsMap ¶ added in v1.1.17
type CastleWallExtraLargeHazardsMap struct{}
func (CastleWallExtraLargeHazardsMap) ID ¶ added in v1.1.17
func (m CastleWallExtraLargeHazardsMap) ID() string
func (CastleWallExtraLargeHazardsMap) Meta ¶ added in v1.1.17
func (m CastleWallExtraLargeHazardsMap) Meta() Metadata
func (CastleWallExtraLargeHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m CastleWallExtraLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (CastleWallExtraLargeHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m CastleWallExtraLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (CastleWallExtraLargeHazardsMap) SetupBoard ¶ added in v1.1.17
func (m CastleWallExtraLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type CastleWallLargeHazardsMap ¶ added in v1.1.17
type CastleWallLargeHazardsMap struct{}
func (CastleWallLargeHazardsMap) ID ¶ added in v1.1.17
func (m CastleWallLargeHazardsMap) ID() string
func (CastleWallLargeHazardsMap) Meta ¶ added in v1.1.17
func (m CastleWallLargeHazardsMap) Meta() Metadata
func (CastleWallLargeHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m CastleWallLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (CastleWallLargeHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m CastleWallLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (CastleWallLargeHazardsMap) SetupBoard ¶ added in v1.1.17
func (m CastleWallLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type CastleWallMediumHazardsMap ¶ added in v1.1.17
type CastleWallMediumHazardsMap struct{}
func (CastleWallMediumHazardsMap) ID ¶ added in v1.1.17
func (m CastleWallMediumHazardsMap) ID() string
func (CastleWallMediumHazardsMap) Meta ¶ added in v1.1.17
func (m CastleWallMediumHazardsMap) Meta() Metadata
func (CastleWallMediumHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m CastleWallMediumHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (CastleWallMediumHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m CastleWallMediumHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (CastleWallMediumHazardsMap) SetupBoard ¶ added in v1.1.17
func (m CastleWallMediumHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type ColumnsHazardsMap ¶ added in v1.1.6
type ColumnsHazardsMap struct{}
func (ColumnsHazardsMap) ID ¶ added in v1.1.6
func (m ColumnsHazardsMap) ID() string
func (ColumnsHazardsMap) Meta ¶ added in v1.1.6
func (m ColumnsHazardsMap) Meta() Metadata
func (ColumnsHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m ColumnsHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ColumnsHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m ColumnsHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ColumnsHazardsMap) SetupBoard ¶ added in v1.1.6
func (m ColumnsHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type ConcentricRingsHazardsMap ¶ added in v1.1.6
type ConcentricRingsHazardsMap struct{}
func (ConcentricRingsHazardsMap) ID ¶ added in v1.1.6
func (m ConcentricRingsHazardsMap) ID() string
func (ConcentricRingsHazardsMap) Meta ¶ added in v1.1.6
func (m ConcentricRingsHazardsMap) Meta() Metadata
func (ConcentricRingsHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m ConcentricRingsHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ConcentricRingsHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m ConcentricRingsHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ConcentricRingsHazardsMap) SetupBoard ¶ added in v1.1.6
func (m ConcentricRingsHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type Dimensions ¶ added in v1.1.10
type Dimensions struct { // Width is the width, in number of board squares, of the board. // The value 0 has a special meaning to mean unlimited. Width int // Height is the height, in number of board squares, of the board. // The value 0 has a special meaning to mean unlimited. Height int }
Dimensions describes the size of a Battlesnake board.
type DirectionalExpandingBoxMap ¶ added in v1.1.6
type DirectionalExpandingBoxMap struct{}
func (DirectionalExpandingBoxMap) ID ¶ added in v1.1.6
func (m DirectionalExpandingBoxMap) ID() string
func (DirectionalExpandingBoxMap) Meta ¶ added in v1.1.6
func (m DirectionalExpandingBoxMap) Meta() Metadata
func (DirectionalExpandingBoxMap) PostUpdateBoard ¶ added in v1.2.0
func (m DirectionalExpandingBoxMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (DirectionalExpandingBoxMap) PreUpdateBoard ¶ added in v1.2.0
func (m DirectionalExpandingBoxMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (DirectionalExpandingBoxMap) SetupBoard ¶ added in v1.1.6
func (m DirectionalExpandingBoxMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type Editor ¶
type Editor interface { // Clears all food from the board. ClearFood() // Adds a food to the board. Does not check for duplicates. AddFood(rules.Point) // Removes all food from a specific tile on the board. RemoveFood(rules.Point) // Get the locations of food currently on the board. // Note: the return value is a copy and modifying it won't affect the board. Food() []rules.Point // Clears all hazards from the board. ClearHazards() // Adds a hazard to the board. Does not check for duplicates. AddHazard(rules.Point) // Removes all hazards from a specific tile on the board. RemoveHazard(rules.Point) // Get the locations of hazards currently on the board. // Note: the return value is a copy and modifying it won't affect the board. Hazards() []rules.Point // Updates the body and health of a snake. PlaceSnake(id string, body []rules.Point, health int) // Get the bodies of all non-eliminated snakes currently on the board, keyed by Snake ID // Note: the body values in the return value are a copy and modifying them won't affect the board. SnakeBodies() map[string][]rules.Point // Get an editable reference to the BoardState's GameState field GameState() map[string]string // Get an editable reference to the BoardState's PointState field PointState() map[rules.Point]int // Given a list of Snakes and a list of head coordinates, randomly place // the snakes on those coordinates, or return an error if placement of all // Snakes is impossible. PlaceSnakesRandomlyAtPositions(rand rules.Rand, snakes []rules.Snake, heads []rules.Point, bodyLength int) error // Returns true if the provided point on the board is occupied by a snake body, food, and/or hazard. IsOccupied(point rules.Point, snakes, hazards, food bool) bool // Get a set of all points on the board the are occupied by snake bodies, food, and/or hazards. // The value for each point will be set to true in the return value if that point is occupied by one of the selected objects. OccupiedPoints(snakes, hazards, food bool) map[rules.Point]bool // Given a list of points, return only those that are unoccupied by snake bodies, food, and/or hazards. FilterUnoccupiedPoints(targets []rules.Point, snakes, hazards, food bool) []rules.Point // Shuffle the provided slice of points randomly using the provided rules.Rand ShufflePoints(rules.Rand, []rules.Point) }
Editor is used by GameMap implementations to modify the board state.
type EmptyMap ¶ added in v1.1.2
type EmptyMap struct{}
func (EmptyMap) PostUpdateBoard ¶ added in v1.2.0
func (EmptyMap) PreUpdateBoard ¶ added in v1.2.0
func (EmptyMap) SetupBoard ¶ added in v1.1.2
type ExpandingBoxMap ¶ added in v1.1.6
type ExpandingBoxMap struct{}
func (ExpandingBoxMap) ID ¶ added in v1.1.6
func (m ExpandingBoxMap) ID() string
func (ExpandingBoxMap) Meta ¶ added in v1.1.6
func (m ExpandingBoxMap) Meta() Metadata
func (ExpandingBoxMap) PostUpdateBoard ¶ added in v1.2.0
func (m ExpandingBoxMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ExpandingBoxMap) PreUpdateBoard ¶ added in v1.2.0
func (m ExpandingBoxMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ExpandingBoxMap) SetupBoard ¶ added in v1.1.6
func (m ExpandingBoxMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type ExpandingScatterMap ¶ added in v1.1.6
type ExpandingScatterMap struct{}
func (ExpandingScatterMap) ID ¶ added in v1.1.6
func (m ExpandingScatterMap) ID() string
func (ExpandingScatterMap) Meta ¶ added in v1.1.6
func (m ExpandingScatterMap) Meta() Metadata
func (ExpandingScatterMap) PostUpdateBoard ¶ added in v1.2.0
func (m ExpandingScatterMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ExpandingScatterMap) PreUpdateBoard ¶ added in v1.2.0
func (m ExpandingScatterMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ExpandingScatterMap) SetupBoard ¶ added in v1.1.6
func (m ExpandingScatterMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type GameMap ¶
type GameMap interface { // Return a unique identifier for this map. ID() string // Return non-functional metadata about this map. Meta() Metadata // Called to generate a new board. The map is responsible for placing all snakes, food, and hazards. SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error // Called every turn to optionally update the board before the board is sent to snakes to get their moves. // Changes made here will be seen by snakes before before making their moves, but users in the // browser will see the changes at the same time as the snakes' moves. // // State that is stored in the map by this method will be visible to the PostUpdateBoard method // later in the same turn, but will not nessecarily be available when processing later turns. // // Disclaimer: Unless you have a specific usecase like moving hazards or storing intermediate state, // PostUpdateBoard is probably the better function to use. PreUpdateBoard(previousBoardState *rules.BoardState, settings rules.Settings, editor Editor) error // Called every turn to optionally update the board after all other rules have been applied. // Changes made here will be seen by both snakes and users in the browser, before before snakes // make their next moves. PostUpdateBoard(previousBoardState *rules.BoardState, settings rules.Settings, editor Editor) error }
type HazardPitsMap ¶ added in v1.1.17
type HazardPitsMap struct{}
func (HazardPitsMap) AddHazardPits ¶ added in v1.1.17
func (m HazardPitsMap) AddHazardPits(board *rules.BoardState, settings rules.Settings, editor Editor)
func (HazardPitsMap) ID ¶ added in v1.1.17
func (m HazardPitsMap) ID() string
func (HazardPitsMap) Meta ¶ added in v1.1.17
func (m HazardPitsMap) Meta() Metadata
func (HazardPitsMap) PostUpdateBoard ¶ added in v1.2.0
func (m HazardPitsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (HazardPitsMap) PreUpdateBoard ¶ added in v1.2.0
func (m HazardPitsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (HazardPitsMap) SetupBoard ¶ added in v1.1.17
func (m HazardPitsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type HealingPoolsMap ¶ added in v1.1.14
type HealingPoolsMap struct{}
func (HealingPoolsMap) ID ¶ added in v1.1.14
func (m HealingPoolsMap) ID() string
func (HealingPoolsMap) Meta ¶ added in v1.1.14
func (m HealingPoolsMap) Meta() Metadata
func (HealingPoolsMap) PostUpdateBoard ¶ added in v1.2.0
func (m HealingPoolsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (HealingPoolsMap) PreUpdateBoard ¶ added in v1.2.0
func (m HealingPoolsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (HealingPoolsMap) SetupBoard ¶ added in v1.1.14
func (m HealingPoolsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type InnerBorderHazardsMap ¶ added in v1.1.6
type InnerBorderHazardsMap struct{}
func (InnerBorderHazardsMap) ID ¶ added in v1.1.6
func (m InnerBorderHazardsMap) ID() string
func (InnerBorderHazardsMap) Meta ¶ added in v1.1.6
func (m InnerBorderHazardsMap) Meta() Metadata
func (InnerBorderHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m InnerBorderHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (InnerBorderHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m InnerBorderHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (InnerBorderHazardsMap) SetupBoard ¶ added in v1.1.6
func (m InnerBorderHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type IslandsAndBridgesLargeHazardsMap ¶ added in v1.1.17
type IslandsAndBridgesLargeHazardsMap struct{}
func (IslandsAndBridgesLargeHazardsMap) ID ¶ added in v1.1.17
func (m IslandsAndBridgesLargeHazardsMap) ID() string
func (IslandsAndBridgesLargeHazardsMap) Meta ¶ added in v1.1.17
func (m IslandsAndBridgesLargeHazardsMap) Meta() Metadata
func (IslandsAndBridgesLargeHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m IslandsAndBridgesLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (IslandsAndBridgesLargeHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m IslandsAndBridgesLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (IslandsAndBridgesLargeHazardsMap) SetupBoard ¶ added in v1.1.17
func (m IslandsAndBridgesLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type IslandsAndBridgesMediumHazardsMap ¶ added in v1.1.17
type IslandsAndBridgesMediumHazardsMap struct{}
func (IslandsAndBridgesMediumHazardsMap) ID ¶ added in v1.1.17
func (m IslandsAndBridgesMediumHazardsMap) ID() string
func (IslandsAndBridgesMediumHazardsMap) Meta ¶ added in v1.1.17
func (m IslandsAndBridgesMediumHazardsMap) Meta() Metadata
func (IslandsAndBridgesMediumHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m IslandsAndBridgesMediumHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (IslandsAndBridgesMediumHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m IslandsAndBridgesMediumHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (IslandsAndBridgesMediumHazardsMap) SetupBoard ¶ added in v1.1.17
func (m IslandsAndBridgesMediumHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type MapRegistry ¶
MapRegistry is a mapping of map names to game maps.
func (MapRegistry) GetMap ¶
func (registry MapRegistry) GetMap(id string) (GameMap, error)
GetMap returns the map associated with the given ID.
func (MapRegistry) List ¶ added in v1.1.15
func (registry MapRegistry) List() []string
List returns all registered map IDs in alphabetical order
func (MapRegistry) RegisterMap ¶
func (registry MapRegistry) RegisterMap(id string, m GameMap)
RegisterMap adds a stage to the registry. If a map has already been registered this will panic.
type Metadata ¶
type Metadata struct { Name string Author string Description string // Version is the current version of the game map. // Each time a map is changed, the version number should be incremented by 1. Version int // MinPlayers is the minimum number of players that the map supports. MinPlayers int // MaxPlayers is the maximum number of players that the map supports. MaxPlayers int // BoardSizes is a list of supported board sizes. Board sizes can fall into one of 3 categories: // 1. one fixed size (i.e. [11x11]) // 2. multiple, fixed sizes (i.e. [11x11, 19x19, 25x25]) // 3. "unlimited" sizes (the board is not fixed and can scale to any reasonable size) BoardSizes sizes // Tags is a list of strings use to categorize the map. Tags []string }
type RiverAndBridgesExtraLargeHazardsMap ¶ added in v1.1.16
type RiverAndBridgesExtraLargeHazardsMap struct{}
func (RiverAndBridgesExtraLargeHazardsMap) ID ¶ added in v1.1.16
func (m RiverAndBridgesExtraLargeHazardsMap) ID() string
func (RiverAndBridgesExtraLargeHazardsMap) Meta ¶ added in v1.1.16
func (m RiverAndBridgesExtraLargeHazardsMap) Meta() Metadata
func (RiverAndBridgesExtraLargeHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m RiverAndBridgesExtraLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (RiverAndBridgesExtraLargeHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m RiverAndBridgesExtraLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (RiverAndBridgesExtraLargeHazardsMap) SetupBoard ¶ added in v1.1.16
func (m RiverAndBridgesExtraLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type RiverAndBridgesLargeHazardsMap ¶ added in v1.1.16
type RiverAndBridgesLargeHazardsMap struct{}
func (RiverAndBridgesLargeHazardsMap) ID ¶ added in v1.1.16
func (m RiverAndBridgesLargeHazardsMap) ID() string
func (RiverAndBridgesLargeHazardsMap) Meta ¶ added in v1.1.16
func (m RiverAndBridgesLargeHazardsMap) Meta() Metadata
func (RiverAndBridgesLargeHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m RiverAndBridgesLargeHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (RiverAndBridgesLargeHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m RiverAndBridgesLargeHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (RiverAndBridgesLargeHazardsMap) SetupBoard ¶ added in v1.1.16
func (m RiverAndBridgesLargeHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type RiverAndBridgesMediumHazardsMap ¶ added in v1.1.16
type RiverAndBridgesMediumHazardsMap struct{}
func (RiverAndBridgesMediumHazardsMap) ID ¶ added in v1.1.16
func (m RiverAndBridgesMediumHazardsMap) ID() string
func (RiverAndBridgesMediumHazardsMap) Meta ¶ added in v1.1.16
func (m RiverAndBridgesMediumHazardsMap) Meta() Metadata
func (RiverAndBridgesMediumHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m RiverAndBridgesMediumHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (RiverAndBridgesMediumHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m RiverAndBridgesMediumHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (RiverAndBridgesMediumHazardsMap) SetupBoard ¶ added in v1.1.16
func (m RiverAndBridgesMediumHazardsMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type RoyaleHazardsMap ¶ added in v1.1.2
type RoyaleHazardsMap struct{}
func (RoyaleHazardsMap) ID ¶ added in v1.1.2
func (m RoyaleHazardsMap) ID() string
func (RoyaleHazardsMap) Meta ¶ added in v1.1.2
func (m RoyaleHazardsMap) Meta() Metadata
func (RoyaleHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m RoyaleHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (RoyaleHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m RoyaleHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (RoyaleHazardsMap) SetupBoard ¶ added in v1.1.2
func (m RoyaleHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type ScatterFillMap ¶ added in v1.1.6
type ScatterFillMap struct{}
func (ScatterFillMap) ID ¶ added in v1.1.6
func (m ScatterFillMap) ID() string
func (ScatterFillMap) Meta ¶ added in v1.1.6
func (m ScatterFillMap) Meta() Metadata
func (ScatterFillMap) PostUpdateBoard ¶ added in v1.2.0
func (m ScatterFillMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ScatterFillMap) PreUpdateBoard ¶ added in v1.2.0
func (m ScatterFillMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (ScatterFillMap) SetupBoard ¶ added in v1.1.6
func (m ScatterFillMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type SinkholesMap ¶ added in v1.1.14
type SinkholesMap struct{}
func (SinkholesMap) ID ¶ added in v1.1.14
func (m SinkholesMap) ID() string
func (SinkholesMap) Meta ¶ added in v1.1.14
func (m SinkholesMap) Meta() Metadata
func (SinkholesMap) PostUpdateBoard ¶ added in v1.2.0
func (m SinkholesMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (SinkholesMap) PreUpdateBoard ¶ added in v1.2.0
func (m SinkholesMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (SinkholesMap) SetupBoard ¶ added in v1.1.14
func (m SinkholesMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type SnailModeMap ¶ added in v1.1.16
type SnailModeMap struct{}
func (SnailModeMap) ID ¶ added in v1.1.16
func (m SnailModeMap) ID() string
ID returns a unique identifier for this map.
func (SnailModeMap) Meta ¶ added in v1.1.16
func (m SnailModeMap) Meta() Metadata
Meta returns the non-functional metadata about this map.
func (SnailModeMap) PostUpdateBoard ¶ added in v1.2.0
func (m SnailModeMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
PostUpdateBoard does the work of placing the hazards along the 'snail tail' of snakes This is responsible for saving the current tail location off the board and restoring the previous tail position. This also handles removing one hazards from the current stacks so the hazards tails fade as the snake moves away.
func (SnailModeMap) PreUpdateBoard ¶ added in v1.2.0
func (m SnailModeMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (SnailModeMap) SetupBoard ¶ added in v1.1.16
func (m SnailModeMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
SetupBoard here is pretty 'standard' and doesn't do any special setup for this game mode
type SoloMazeMap ¶ added in v1.1.12
type SoloMazeMap struct{}
func (SoloMazeMap) AdjustPosition ¶ added in v1.1.12
func (SoloMazeMap) CreateMaze ¶ added in v1.1.12
func (m SoloMazeMap) CreateMaze(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor, currentLevel int64) error
func (SoloMazeMap) ID ¶ added in v1.1.12
func (m SoloMazeMap) ID() string
func (SoloMazeMap) Meta ¶ added in v1.1.12
func (m SoloMazeMap) Meta() Metadata
func (SoloMazeMap) PlaceFood ¶ added in v1.1.12
func (m SoloMazeMap) PlaceFood(boardState *rules.BoardState, settings rules.Settings, editor Editor, currentLevel int64)
func (SoloMazeMap) PostUpdateBoard ¶ added in v1.2.0
func (m SoloMazeMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (SoloMazeMap) PreUpdateBoard ¶ added in v1.2.0
func (m SoloMazeMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (SoloMazeMap) ReadBitState ¶ added in v1.1.12
func (m SoloMazeMap) ReadBitState(boardState *rules.BoardState) (int64, error)
func (SoloMazeMap) SetupBoard ¶ added in v1.1.12
func (m SoloMazeMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (SoloMazeMap) SubdivideRoom ¶ added in v1.1.12
func (m SoloMazeMap) SubdivideRoom(tempBoardState *rules.BoardState, rand rules.Rand, lowPoint rules.Point, highPoint rules.Point, disAllowedHorizontal []int, disAllowedVertical []int, depth int) bool
Mostly based off this algorithm from Wikipedia: https://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_division_method
func (SoloMazeMap) WriteBitState ¶ added in v1.1.12
func (m SoloMazeMap) WriteBitState(boardState *rules.BoardState, state int64, editor Editor)
type SpiralHazardsMap ¶ added in v1.1.6
type SpiralHazardsMap struct{}
func (SpiralHazardsMap) ID ¶ added in v1.1.6
func (m SpiralHazardsMap) ID() string
func (SpiralHazardsMap) Meta ¶ added in v1.1.6
func (m SpiralHazardsMap) Meta() Metadata
func (SpiralHazardsMap) PostUpdateBoard ¶ added in v1.2.0
func (m SpiralHazardsMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (SpiralHazardsMap) PreUpdateBoard ¶ added in v1.2.0
func (m SpiralHazardsMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (SpiralHazardsMap) SetupBoard ¶ added in v1.1.6
func (m SpiralHazardsMap) SetupBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type StandardMap ¶
type StandardMap struct{}
func (StandardMap) ID ¶
func (m StandardMap) ID() string
func (StandardMap) Meta ¶
func (m StandardMap) Meta() Metadata
func (StandardMap) PostUpdateBoard ¶ added in v1.2.0
func (m StandardMap) PostUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (StandardMap) PreUpdateBoard ¶ added in v1.2.0
func (m StandardMap) PreUpdateBoard(lastBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
func (StandardMap) SetupBoard ¶
func (m StandardMap) SetupBoard(initialBoardState *rules.BoardState, settings rules.Settings, editor Editor) error
type StubMap ¶ added in v1.1.1
type StubMap struct { Id string SnakePositions map[string]rules.Point Food []rules.Point Hazards []rules.Point Error error }
An implementation of GameMap that just does predetermined placements, for testing.