private void tick(Map map, Snake[] snakes) {
		if (newDirection != getHead().heading) {
			getHead().heading = newDirection;
		}
		int newX = getHead().x + Snake.xOffset(getHead().heading);
		int newY = getHead().y + Snake.yOffset(getHead().heading);
		if (isNotPassable(map, snakes, newX, newY)) {
			hasCrashed = true;
			return;
		}
		boolean hasJustGrown = false;
		if (growth > 0) {
			addTail();
			hasJustGrown = true;
			growth -= 1;
		}
		if (length() > 1) {
			for (int i = length() - (hasJustGrown ? 2 : 1); i > 0; i --) {
				body.get(i).x = body.get(i-1).x;
				body.get(i).y = body.get(i-1).y;
				body.get(i).heading = body.get(i-1).heading;
			}
		}
		getHead().x = newX;
		getHead().y = newY;
		if (map.pelletAt(newX, newY)) {
			eatPellet(map, newX, newY);
		}
		for (int i = pelletsEating.size()-1; i >= 0; i --) {
			if (cellAt(pelletsEating.get(i).x, pelletsEating.get(i).y) == -1) {
				pelletsEating.remove(i);
			}
		}
	}