class BattleSnake::Board
- BattleSnake::Board
- Reference
- Object
Overview
Represents the Board as it arrives from the BattleSnake API endpoint.
@snake_points is an Array(BattleSnake::Point)
variable populated when a
Board is initialized and contains all the Points that are currently occupied
by a snake (would represent a collision).
Included Modules
- JSON::Serializable
Defined in:
battle_snake/board.crConstructors
Instance Method Summary
- #after_initialize
-
#find_snake_points
Executed on
#after_initialize
callback and all it does is populate snake_points variable (Array(Point)
) with all points that belong to a snake on the board - #food : Array(Point)
- #food=(food : Array(Point))
- #hazards : Array(Point)
- #hazards=(hazards : Array(Point))
- #height : Int32
- #height=(height : Int32)
-
#living?(id)
Returns true if a snake id passed as parameter is alive on the board, returns false otherwise.
- #snake_points : Array(Point)
- #snakes : Array(Snake)
- #snakes=(snakes : Array(Snake))
- #width : Int32
- #width=(width : Int32)
Constructor Detail
Instance Method Detail
Executed on #after_initialize
callback and all it does is populate
snake_points variable (Array(Point)
) with all points that belong to a
snake on the board
Returns true if a snake id passed as parameter is alive on the board, returns false otherwise.