import random
import spritz

GHOSTU = '1234'
AI_TRIGGER = True


def get_things_around(center, grid, name=""):
    return [grid[center[1] - 1][center[0]],
            grid[center[1] + 1][center[0]], grid[center[1]][center[0] + 1], grid[center[1]][center[0] - 1]]


class Trucquibouge(spritz.Spritz):
    def __init__(self, pos=[0, 0], name="truc random", letter='E'):
        self.pos = pos
        self.is_dead = False  # ?
        self.name = name
        self.letter = letter
        self.direction = "RIGHT"
        super().__init__(self.pos, self.direction, "Pacu")

    def die(self):
        self.is_dead = True

    def revive(self):
        self.is_dead = False

    def am_i_in_pacuroni(self):
        return self.is_dead

    def up(self):
        self.pos[1] -= 1

    def down(self):
        self.pos[1] += 1

    def left(self):
        self.pos[0] -= 1

    def right(self):
        self.pos[0] += 1

    def move(self, direction, thingsaround):
        pass

    def update(self, grid, direction="NONE"):
        return self.move(get_things_around(self.pos, grid, name=self.name), direction)

    def __str__(self):
        return "I'm {} {}, AM I DEAD : {}".format(self.name, self.pos, self.is_dead)

    def __repr__(self):
        return self.__str__()

3649659aab6e5639875b3e5275c563fa662914e0
<mask token>


class Trucquibouge(spritz.Spritz):
    <mask token>

    def die(self):
        self.is_dead = True
    <mask token>
    <mask token>
    <mask token>

    def down(self):
        self.pos[1] += 1

    def left(self):
        self.pos[0] -= 1
    <mask token>

    def move(self, direction, thingsaround):
        pass

    def update(self, grid, direction='NONE'):
        return self.move(get_things_around(self.pos, grid, name=self.name),
            direction)

    def __str__(self):
        return "I'm {} {}, AM I DEAD : {}".format(self.name, self.pos, self
            .is_dead)

    def __repr__(self):
        return self.__str__()

<mask token>


class Trucquibouge(spritz.Spritz):
    <mask token>

    def die(self):
        self.is_dead = True
    <mask token>

    def am_i_in_pacuroni(self):
        return self.is_dead
    <mask token>

    def down(self):
        self.pos[1] += 1

    def left(self):
        self.pos[0] -= 1

    def right(self):
        self.pos[0] += 1

    def move(self, direction, thingsaround):
        pass

    def update(self, grid, direction='NONE'):
        return self.move(get_things_around(self.pos, grid, name=self.name),
            direction)

    def __str__(self):
        return "I'm {} {}, AM I DEAD : {}".format(self.name, self.pos, self
            .is_dead)

    def __repr__(self):
        return self.__str__()

<mask token>


def get_things_around(center, grid, name=''):
    return [grid[center[1] - 1][center[0]], grid[center[1] + 1][center[0]],
        grid[center[1]][center[0] + 1], grid[center[1]][center[0] - 1]]


class Trucquibouge(spritz.Spritz):

    def __init__(self, pos=[0, 0], name='truc random', letter='E'):
        self.pos = pos
        self.is_dead = False
        self.name = name
        self.letter = letter
        self.direction = 'RIGHT'
        super().__init__(self.pos, self.direction, 'Pacu')

    def die(self):
        self.is_dead = True

    def revive(self):
        self.is_dead = False

    def am_i_in_pacuroni(self):
        return self.is_dead

    def up(self):
        self.pos[1] -= 1

    def down(self):
        self.pos[1] += 1

    def left(self):
        self.pos[0] -= 1

    def right(self):
        self.pos[0] += 1

    def move(self, direction, thingsaround):
        pass

    def update(self, grid, direction='NONE'):
        return self.move(get_things_around(self.pos, grid, name=self.name),
            direction)

    def __str__(self):
        return "I'm {} {}, AM I DEAD : {}".format(self.name, self.pos, self
            .is_dead)

    def __repr__(self):
        return self.__str__()

<mask token>
GHOSTU = '1234'
AI_TRIGGER = True


def get_things_around(center, grid, name=''):
    return [grid[center[1] - 1][center[0]], grid[center[1] + 1][center[0]],
        grid[center[1]][center[0] + 1], grid[center[1]][center[0] - 1]]


class Trucquibouge(spritz.Spritz):

    def __init__(self, pos=[0, 0], name='truc random', letter='E'):
        self.pos = pos
        self.is_dead = False
        self.name = name
        self.letter = letter
        self.direction = 'RIGHT'
        super().__init__(self.pos, self.direction, 'Pacu')

    def die(self):
        self.is_dead = True

    def revive(self):
        self.is_dead = False

    def am_i_in_pacuroni(self):
        return self.is_dead

    def up(self):
        self.pos[1] -= 1

    def down(self):
        self.pos[1] += 1

    def left(self):
        self.pos[0] -= 1

    def right(self):
        self.pos[0] += 1

    def move(self, direction, thingsaround):
        pass

    def update(self, grid, direction='NONE'):
        return self.move(get_things_around(self.pos, grid, name=self.name),
            direction)

    def __str__(self):
        return "I'm {} {}, AM I DEAD : {}".format(self.name, self.pos, self
            .is_dead)

    def __repr__(self):
        return self.__str__()

import random
import spritz

GHOSTU = '1234'
AI_TRIGGER = True


def get_things_around(center, grid, name=""):
    return [grid[center[1] - 1][center[0]],
            grid[center[1] + 1][center[0]], grid[center[1]][center[0] + 1], grid[center[1]][center[0] - 1]]


class Trucquibouge(spritz.Spritz):
    def __init__(self, pos=[0, 0], name="truc random", letter='E'):
        self.pos = pos
        self.is_dead = False  # ?
        self.name = name
        self.letter = letter
        self.direction = "RIGHT"
        super().__init__(self.pos, self.direction, "Pacu")

    def die(self):
        self.is_dead = True

    def revive(self):
        self.is_dead = False

    def am_i_in_pacuroni(self):
        return self.is_dead

    def up(self):
        self.pos[1] -= 1

    def down(self):
        self.pos[1] += 1

    def left(self):
        self.pos[0] -= 1

    def right(self):
        self.pos[0] += 1

    def move(self, direction, thingsaround):
        pass

    def update(self, grid, direction="NONE"):
        return self.move(get_things_around(self.pos, grid, name=self.name), direction)

    def __str__(self):
        return "I'm {} {}, AM I DEAD : {}".format(self.name, self.pos, self.is_dead)

    def __repr__(self):
        return self.__str__()
