SnakeInterface
In addition to the methods and attributes described in the overview, this interface provides the method and attributes below.
Methods
| Method | Description |
|---|---|
SnakeInterface.set_direction(direction) |
Turns the snake, at once. direction is one of the attributes below. Calling this more than once in an update means the last call is the one the engine has when the tick comes round, and not calling it leaves the snake going the way it already was. A snake cannot turn back on itself. A direction that is not a whole number raises a TypeError, and one that is not one of the four raises a ValueError, before anything is sent. |
Attributes
| Name | Value |
|---|---|
SnakeInterface.N |
0 |
SnakeInterface.E |
1 |
SnakeInterface.S |
2 |
SnakeInterface.W |
3 |
SnakeInterface.WIDTH |
14 |
SnakeInterface.HEIGHT |
13 |