import * as R from "remeda"; import { parseLines, spy } from "./part1.js"; function moveStacks([stacks, commands]) { for (let [move, from, to] of commands) { console.log({ move, from, to }); stacks[to - 1].push( ...stacks[from - 1].splice(stacks[from - 1].length - move) ); } return stacks; } export default R.createPipe( (text) => text.split("\n\n"), parseLines, moveStacks, spy, R.map((x) => x.pop()), (x) => x.join("") );