SnakeGameState
Attribute | Description |
---|---|
state.snake |
A numpy array for the (row, column) coordinates of the snake's body ordered head to tail. |
state.apple |
The (row, column) coordinates of the apple as a numpy array. |
state.direction |
An integer representing the direction the snake was going on the previous tick. |
state.hunger |
An integer representing the hunger of your snake. |
Example
Rendered State
Values in Code
class Algo:
# ...
def take_turn(
self,
state: SnakeGameState,
interface: SnakeInterface
) -> int:
interface.log(state.snake)
# > array([
# [3, 10],
# [3, 11],
# [3, 12],
# [3, 13],
# [3, 14],
# [4, 14],
# [5, 14],
# [6, 14]
# ])
interface.log(state.apple)
# > array([10, 0])
interface.log(state.hunger)
# > 401
interface.log(state.direction)
# > 3