blizzards = {
const { lines, width, height } = parsed;
const directions = { ">": [1, 0], "<": [-1, 0], "^": [0, -1], v: [0, 1] };
const blizzards = [];
lines.forEach((l, y) => {
[...l].forEach((c, x) => {
if (c !== "#" && c !== ".") {
const [dx, dy] = directions[c];
blizzards.push((t) => [
(((x - 1 + dx * t) % width) + width) % width,
(((y - 1 + dy * t) % height) + height) % height
]);
}
});
});
return (t) =>
new d3.InternSet(
blizzards.map((f) => f(t)),
String
);
}