def __init__(self, game, row, col):
        self.position = 0
        self.cells = [
            Cell(game.grid, row - 1, col + 0, UI['color']['red']),
            Cell(game.grid, row + 0, col + 0, UI['color']['red']),
            Cell(game.grid, row + 1, col + 0, UI['color']['red']),
            Cell(game.grid, row + 1, col + 1, UI['color']['red'])
        ]

        Shape.__init__(self, game)
Beispiel #2
0
# directions
RIGHT = 6
LEFT = 4
UP = 8
DOWN = 2
NONE = 5

# key mapping
KEY_UP = "'\\x1b[A'"
KEY_DOWN = "'\\x1b[B'"
KEY_LEFT = "'\\x1b[D'"
KEY_RIGHT = "'\\x1b[C'"
KEY_QUIT = "'q'"

# cell content
EMPTY = Cell(" ")
FOOD = Cell("X")

SNAKE_BODY = Cell("o")
SNAKE_TAIL = Cell("*")
SNAKE_UP = Cell("ʌ")
SNAKE_DOWN = Cell("v")
SNAKE_LEFT = Cell("<")
SNAKE_RIGHT = Cell(">")

DIMENSION = 9


class Snake:
    key = None