Versions in this module Expand all Collapse all v1 v1.0.31 Mar 30, 2022 Changes in this version + const BoardSizeLarge + const BoardSizeMedium + const BoardSizeSmall + const EliminatedByCollision + const EliminatedByHeadToHeadCollision + const EliminatedByOutOfBounds + const EliminatedByOutOfHealth + const EliminatedBySelfCollision + const EliminatedBySquad + const ErrorNoMoveFound + const ErrorNoRoomForFood + const ErrorNoRoomForSnake + const ErrorTooManySnakes + const ErrorZeroLengthSnake + const GameTypeConstrictor + const GameTypeRoyale + const GameTypeSolo + const GameTypeSquad + const GameTypeStandard + const GameTypeWrapped + const MoveDown + const MoveLeft + const MoveRight + const MoveUp + const NotEliminated + const ParamAllowBodyCollisions + const ParamFoodSpawnChance + const ParamGameType + const ParamHazardDamagePerTurn + const ParamHazardMap + const ParamHazardMapAuthor + const ParamMinimumFood + const ParamSharedElimination + const ParamSharedHealth + const ParamSharedLength + const ParamShrinkEveryNTurns + const SnakeMaxHealth + const SnakeStartSize + func DamageHazardsStandard(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func EliminateSnakesStandard(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func FeedSnakesStandard(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func GameOverSolo(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func GameOverSquad(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func GameOverStandard(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func GrowSnakesConstrictor(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func MoveSnakesStandard(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func MoveSnakesWrapped(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func NewRulesetBuilder() *rulesetBuilder + func PlaceFoodAutomatically(b *BoardState) error + func PlaceFoodFixed(b *BoardState) error + func PlaceFoodRandomly(b *BoardState, n int32) error + func PlaceSnake(b *BoardState, snakeID string, body []Point) error + func PlaceSnakesAutomatically(b *BoardState, snakeIDs []string) error + func PlaceSnakesFixed(b *BoardState, snakeIDs []string) error + func PlaceSnakesRandomly(b *BoardState, snakeIDs []string) error + func PopulateHazardsRoyale(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func ReduceSnakeHealthStandard(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func RemoveFoodConstrictor(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func ResurrectSnakesSquad(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func ShareAttributesSquad(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + func SpawnFoodStandard(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) + type BoardState struct + Food []Point + Hazards []Point + Height int32 + Snakes []Snake + Turn int32 + Width int32 + func CreateDefaultBoardState(width int32, height int32, snakeIDs []string) (*BoardState, error) + func NewBoardState(width, height int32) *BoardState + func (prevState *BoardState) Clone() *BoardState + type ConstrictorRuleset struct + func (r *ConstrictorRuleset) CreateNextBoardState(prevState *BoardState, moves []SnakeMove) (*BoardState, error) + func (r *ConstrictorRuleset) ModifyInitialBoardState(initialBoardState *BoardState) (*BoardState, error) + func (r *ConstrictorRuleset) Name() string + type Point struct + X int32 + Y int32 + type RoyaleRuleset struct + Seed int64 + ShrinkEveryNTurns int32 + func (r *RoyaleRuleset) CreateNextBoardState(prevState *BoardState, moves []SnakeMove) (*BoardState, error) + func (r *RoyaleRuleset) Name() string + func (r RoyaleRuleset) Settings() Settings + type RoyaleSettings struct + ShrinkEveryNTurns int32 + type Ruleset interface + CreateNextBoardState func(prevState *BoardState, moves []SnakeMove) (*BoardState, error) + IsGameOver func(state *BoardState) (bool, error) + ModifyInitialBoardState func(initialState *BoardState) (*BoardState, error) + Name func() string + Settings func() Settings + type RulesetError string + func (err RulesetError) Error() string + type Settings struct + FoodSpawnChance int32 + HazardDamagePerTurn int32 + HazardMap string + HazardMapAuthor string + MinimumFood int32 + RoyaleSettings RoyaleSettings + SquadSettings SquadSettings + type Snake struct + Body []Point + EliminatedBy string + EliminatedCause string + EliminatedOnTurn int32 + Health int32 + ID string + type SnakeMove struct + ID string + Move string + type SoloRuleset struct + func (r *SoloRuleset) IsGameOver(b *BoardState) (bool, error) + func (r *SoloRuleset) Name() string + type SquadRuleset struct + AllowBodyCollisions bool + SharedElimination bool + SharedHealth bool + SharedLength bool + SquadMap map[string]string + func (r *SquadRuleset) CreateNextBoardState(prevState *BoardState, moves []SnakeMove) (*BoardState, error) + func (r *SquadRuleset) IsGameOver(b *BoardState) (bool, error) + func (r *SquadRuleset) Name() string + func (r SquadRuleset) Settings() Settings + type SquadSettings struct + AllowBodyCollisions bool + SharedElimination bool + SharedHealth bool + SharedLength bool + type StageFunc func(*BoardState, Settings, []SnakeMove) (bool, error) + type StandardRuleset struct + FoodSpawnChance int32 + HazardDamagePerTurn int32 + HazardMap string + HazardMapAuthor string + MinimumFood int32 + func (r *StandardRuleset) CreateNextBoardState(prevState *BoardState, moves []SnakeMove) (*BoardState, error) + func (r *StandardRuleset) IsGameOver(b *BoardState) (bool, error) + func (r *StandardRuleset) ModifyInitialBoardState(initialState *BoardState) (*BoardState, error) + func (r *StandardRuleset) Name() string + func (r StandardRuleset) Settings() Settings + type WrappedRuleset struct + func (r *WrappedRuleset) CreateNextBoardState(prevState *BoardState, moves []SnakeMove) (*BoardState, error) + func (r *WrappedRuleset) Name() string