public void automove() {
        int nextX;
        int nextY;

        do {

            nextY = this.posY;
            nextX = this.posX;

            int test = (int) (Math.random() * 4);
            switch (test) {
                case 0:
                    nextX++;
                    break;
                case 1:
                    nextX--;
                    break;
                case 2:
                    nextY++;
                    break;
                case 3:
                    nextY--;
                    break;

            }
        } while ((nextX >= tailleX) || (nextX < 0) || (nextY >= tailleY) || (nextY < 0) && !(labyr[nextX][nextY].canMoveToCase()));

    }