Beta

DuelSnakesInterface

In addition to the methods and attributes described in the overview, this interface provides the method and attributes below.

Methods

Method Description
DuelSnakesInterface.set_direction(direction) Turns your 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 your 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
DuelSnakesInterface.N 0
DuelSnakesInterface.E 1
DuelSnakesInterface.S 2
DuelSnakesInterface.W 3
DuelSnakesInterface.WIDTH 26
DuelSnakesInterface.HEIGHT 25